print "1..4\n";
-
-if (eval {require File::Spec::Functions}) {
- File::Spec::Functions->import();
-} else {
- *catfile = sub { join '/', @_ };
-}
-$tmpdir = $ENV{TMP} || $ENV{TMPDIR} || '/tmp';
-$file = catfile($tmpdir, "md$$");
-unlink $file, "$file.dir", "$file.pag";
+$file = "md$$";
+1 while unlink $file, "$file.dir", "$file.pag", "$file.db";
tryout('Memoize::NDBM_File', $file, 1); # Test 1..4
-unlink $file, "$file.dir", "$file.pag";
+1 while unlink $file, "$file.dir", "$file.pag", "$file.db";
sub tryout {
my ($tiepack, $file, $testno) = @_;
+ tie my %cache => $tiepack, $file, O_RDWR | O_CREAT, 0666
+ or die $!;
+
memoize 'c5',
- SCALAR_CACHE => ['TIE', $tiepack, $file, O_RDWR | O_CREAT, 0666],
+ SCALAR_CACHE => [HASH => \%cache],
LIST_CACHE => 'FAULT'
;
# Now something tricky---we'll memoize c23 with the wrong table that
# has the 5 already cached.
memoize 'c23',
- SCALAR_CACHE => ['TIE', $tiepack, $file, O_RDWR, 0666],
+ SCALAR_CACHE => [HASH => \%cache],
LIST_CACHE => 'FAULT'
;