8 use Memoize 0.45 qw(memoize unmemoize);
11 # print STDERR $INC{'Memoize.pm'}, "\n";
21 print ((!$s) ? "ok 1\n" : "not ok 1\n");
23 print (($a) ? "ok 2\n" : "not ok 2\n");
24 memoize 'xx', LIST_CACHE => MERGE;
26 print ((!$s) ? "ok 3\n" : "not ok 3\n");
27 ($a) = xx(); # Should return cached false value from previous invocation
28 print ((!$a) ? "ok 4\n" : "not ok 4\n");
34 memoize 'ns', SCALAR_CACHE => FAULT;
35 memoize 'na', LIST_CACHE => FAULT;
36 eval { my $s = ns() }; # Should fault
37 print (($@) ? "ok 5\n" : "not ok 5\n");
38 eval { my ($a) = na() }; # Should fault
39 print (($@) ? "ok 6\n" : "not ok 6\n");
45 memoize 'nul', SCALAR_CACHE => [HASH => \%s], LIST_CACHE => [HASH => \%l];
48 print ((join '', sort keys %s) eq 'xy' ? "ok 7\n" : "not ok 7\n");
49 print ((join '', sort keys %l) eq '' ? "ok 8\n" : "not ok 8\n");
52 print ((join '', sort keys %s) eq 'xy' ? "ok 9\n" : "not ok 9\n");
53 print ((join '', sort keys %l) eq 'pq' ? "ok 10\n" : "not ok 10\n");