4 use Memoize 0.45 qw(memoize unmemoize);
6 # use Memoize::GDBM_File;
7 # $Memoize::GDBM_File::Verbose = 0;
23 eval {require GDBM_File};
31 if (eval {require File::Spec::Functions}) {
32 File::Spec::Functions->import();
34 *catfile = sub { join '/', @_ };
36 $tmpdir = $ENV{TMP} || $ENV{TMPDIR} || '/tmp';
37 $file = catfile($tmpdir, "md$$");
38 unlink $file, "$file.dir", "$file.pag";
39 tryout('GDBM_File', $file, 1); # Test 1..4
40 unlink $file, "$file.dir", "$file.pag";
43 my ($tiepack, $file, $testno) = @_;
47 SCALAR_CACHE => ['TIE', $tiepack, $file, O_RDWR | O_CREAT, 0666],
53 print (($t1 == 5) ? "ok $testno\n" : "not ok $testno\n");
55 print (($t2 == 5) ? "ok $testno\n" : "not ok $testno\n");
58 # Now something tricky---we'll memoize c23 with the wrong table that
59 # has the 5 already cached.
61 SCALAR_CACHE => ['TIE', $tiepack, $file, O_RDWR, 0666],
68 print (($t3 == 5) ? "ok $testno\n" : "not ok $testno\n");
70 print (($t4 == 5) ? "ok $testno\n" : "not ok $testno\n");