Upgrade to ExtUtils::MakeMaker 6.28
[p5sagit/p5-mst-13.2.git] / lib / Memoize / t / tie_ndbm.t
index dfbd0f5..a328bc0 100644 (file)
@@ -28,24 +28,20 @@ if ($@) {
 
 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'
     ;
 
@@ -59,7 +55,7 @@ sub tryout {
   # 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'
     ;