2 # -*- mode: perl; perl-indent-level: 2 -*-
8 use Memoize 0.45 qw(memoize unmemoize);
9 # $Memoize::Storable::Verbose = 0;
11 eval {require Memoize::Storable};
31 eval {require Storable};
40 if (eval {require File::Spec::Functions}) {
41 File::Spec::Functions->import();
43 *catfile = sub { join '/', @_ };
45 $tmpdir = $ENV{TMP} || $ENV{TMPDIR} || '/tmp';
46 $file = catfile($tmpdir, "storable$$");
48 tryout('Memoize::Storable', $file, 1); # Test 1..4
52 my ($tiepack, $file, $testno) = @_;
54 tie my %cache => $tiepack, $file
58 SCALAR_CACHE => [HASH => \%cache],
64 print (($t1 == 5) ? "ok $testno\n" : "not ok $testno\n");
66 print (($t2 == 5) ? "ok $testno\n" : "not ok $testno\n");
71 # Now something tricky---we'll memoize c23 with the wrong table that
72 # has the 5 already cached.
74 SCALAR_CACHE => [HASH => \%cache],
81 print (($t3 == 5) ? "ok $testno\n" : "not ok $testno\n");
83 print (($t4 == 5) ? "ok $testno\n" : "not ok $testno\n");