8 use Memoize 0.45 qw(memoize unmemoize);
25 eval {require GDBM_File};
33 if (eval {require File::Spec::Functions}) {
34 File::Spec::Functions->import();
36 *catfile = sub { join '/', @_ };
38 $tmpdir = $ENV{TMP} || $ENV{TMPDIR} || '/tmp';
39 $file = catfile($tmpdir, "md$$");
40 1 while unlink $file, "$file.dir", "$file.pag";
41 tryout('GDBM_File', $file, 1); # Test 1..4
42 1 while unlink $file, "$file.dir", "$file.pag";
46 my ($tiepack, $file, $testno) = @_;
48 tie my %cache => $tiepack, $file, O_RDWR | O_CREAT, 0666
52 SCALAR_CACHE => [HASH => \%cache],
58 print (($t1 == 5) ? "ok $testno\n" : "not ok $testno\n");
60 print (($t2 == 5) ? "ok $testno\n" : "not ok $testno\n");
63 # Now something tricky---we'll memoize c23 with the wrong table that
64 # has the 5 already cached.
66 SCALAR_CACHE => [HASH => \%cache],
73 print (($t3 == 5) ? "ok $testno\n" : "not ok $testno\n");
75 print (($t4 == 5) ? "ok $testno\n" : "not ok $testno\n");