加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

perl坠落在Memoize :: Storable

发布时间:2020-12-16 06:17:13 所属栏目:大数据 来源:网络整理
导读:以下代码(大多数来自Memoize主页)创建一个0字节的文件,然后perl崩溃,退出代码为-1073741819. 我使用ActivePerl 5.10和最新的5.16版本进行了测试. use Memoize;use Memoize::Storable;sub ttt { return 44; }tie my %cache = 'Memoize::Storable','ttt.store'
以下代码(大多数来自Memoize主页)创建一个0字节的文件,然后perl崩溃,退出代码为-1073741819.
我使用ActivePerl 5.10和最新的5.16版本进行了测试.

use Memoize;
use Memoize::Storable;

sub ttt { return 44; }
tie my %cache => 'Memoize::Storable','ttt.store';
memoize 'ttt',SCALAR_CACHE => [HASH => %cache];

这发生在Win XP下的两台差异计算机上.有任何想法吗?

解决方法

完成调用后,需要显式取消对子例程的取消,以便将信息保存到文件中.

use strict;
use warnings;

use Memoize qw/ memoize  unmemoize /;
use Memoize::Storable;

sub ttt { 44 }

tie my %cache => 'Memoize::Storable','ttt.store';

memoize 'ttt',SCALAR_CACHE => [HASH => %cache];

ttt($_) for 1..10;

unmemoize 'ttt';

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读