4 use Memoize 0.52 qw(memoize unmemoize);
6 eval {require Memoize::AnyDBM_File};
20 $ARG = 'Keith Bostic is a pinhead';
33 @files = ($file, "$file.db", "$file.dir", "$file.pag");
34 1 while unlink @files;
37 tryout('Memoize::AnyDBM_File', $file, 1); # Test 1..4
38 # tryout('DB_File', $file, 1); # Test 1..4
39 1 while unlink $file, "$file.dir", "$file.pag";
42 my ($tiepack, $file, $testno) = @_;
44 tie my %cache => $tiepack, $file, O_RDWR | O_CREAT, 0666
48 SCALAR_CACHE => [HASH => \%cache],
54 print (($t1 == 5) ? "ok $testno\n" : "not ok $testno\n");
56 print (($t2 == 5) ? "ok $testno\n" : "not ok $testno\n");
59 # Now something tricky---we'll memoize c23 with the wrong table that
60 # has the 5 already cached.
62 SCALAR_CACHE => ['HASH', \%cache],
69 print (($t3 == 5) ? "ok $testno\n" : "not ok $testno # Result $t3\n");
71 print (($t4 == 5) ? "ok $testno\n" : "not ok $testno # Result $t4\n");
76 my @present = grep -e, @files;
77 if (@present && (@failed = grep { not unlink } @present)) {
78 warn "Can't unlink @failed! ($!)";