Perl crashed Memoize :: Storable

The following code (most of the Memoize homepage) creates a file with 0 bytes and then with a perl error with exit code -1073741819. I tested this with ActivePerl 5.10 and the latest version 5.16.

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

This happens on two different computers under Win XP. Any ideas?

+4
source share
1 answer

You need to explicitly specify the unmemoize subroutine when you finish it so that the information is saved in a file.

 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'; 
+4
source

Source: https://habr.com/ru/post/1487875/


All Articles