4 use Memoize 0.45 qw(memoize unmemoize);
21 eval {require GDBM_File};
29 if (eval {require File::Spec::Functions}) {
30 File::Spec::Functions->import();
32 *catfile = sub { join '/', @_ };
34 $tmpdir = $ENV{TMP} || $ENV{TMPDIR} || '/tmp';
35 $file = catfile($tmpdir, "md$$");
36 1 while unlink $file, "$file.dir", "$file.pag";
37 tryout('GDBM_File', $file, 1); # Test 1..4
38 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\n");
71 print (($t4 == 5) ? "ok $testno\n" : "not ok $testno\n");