我通常使用Storable與nstore,但現在我有一個module有CODE和顯然Storable不喜歡那樣。 我發現YAML(和YAML::XS其中I can't really get to work)。 我也嘗試了一下MooseX::Storage沒有太大的成功。 是否有其他的選擇? 你會推薦什麼?
這是代碼: sub function($&) {
my $param1 = shift;
my $code = shift;
# do something with $param1 and $code
}
如果我嘗試調用它像這樣: function("whatever") {
print "i'm inside the coderef\n";
}