Subject: | Memoize::Expire does not work with LIST_CACHE |
The demonstration script below fails in the 2nd iteration with an error like this:
Can't use string ("ARRAY(0x563a71482010)") as an ARRAY ref while "strict refs" in use at /opt/perl-5.12.3/lib/site_perl/5.12.3/Memoize.pm line 258.
The same memoization without Memoize::Expire (i.e.: remove the LIST_CACHE option) works.
Could be related to https://rt.cpan.org/Ticket/Display.html?id=38344 i.e. a fix there could fix also this problem.
#!/usr/bin/perl
use strict;
use warnings;
use Memoize;
use Memoize::Expire;
tie my %list_cache, 'Memoize::Expire', LIFETIME => 86400;
memoize 'test_function',
LIST_CACHE => [HASH => \%list_cache],
;
sub test_function { return @INC }
for (1..3) {
warn join(", ", test_function());
}
__END__