Upgrade to Memoize 0.65.
[p5sagit/p5-mst-13.2.git] / lib / Memoize / t / tie.t
index 098fb05..c006aac 100755 (executable)
@@ -31,25 +31,22 @@ if (eval {require File::Spec::Functions}) {
 }
 $file = catfile($tmpdir, "md$$");
 @files = ($file, "$file.db", "$file.dir", "$file.pag");
-{ 
-  my @present = grep -e, @files;
-  if (@present && (@failed = grep { not unlink } @present)) {
-    warn "Can't unlink @failed!  ($!)";
-  }
-}
+1 while unlink @files;
 
 
 tryout('Memoize::AnyDBM_File', $file, 1);  # Test 1..4
 # tryout('DB_File', $file, 1);  # Test 1..4
-unlink $file, "$file.dir", "$file.pag";
+1 while unlink $file, "$file.dir", "$file.pag";
 
 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], 
-  LIST_CACHE => 'FAULT'
+    SCALAR_CACHE => [HASH => \%cache],
+    LIST_CACHE => 'FAULT'
     ;
 
   my $t1 = c5($ARG);   
@@ -62,7 +59,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'
     ;