2 # -*- mode: perl; perl-indent-level: 2 -*-
5 use Memoize 0.45 qw(memoize unmemoize);
6 # $Memoize::Storable::Verbose = 0;
8 eval {require Memoize::Storable};
28 eval {require Storable};
37 if (eval {require File::Spec::Functions}) {
38 File::Spec::Functions->import();
40 *catfile = sub { join '/', @_ };
42 $tmpdir = $ENV{TMP} || $ENV{TMPDIR} || '/tmp';
43 $file = catfile($tmpdir, "storable$$");
45 tryout('Memoize::Storable', $file, 1); # Test 1..4
49 my ($tiepack, $file, $testno) = @_;
51 tie my %cache => $tiepack, $file
55 SCALAR_CACHE => [HASH => \%cache],
61 print (($t1 == 5) ? "ok $testno\n" : "not ok $testno\n");
63 print (($t2 == 5) ? "ok $testno\n" : "not ok $testno\n");
68 # Now something tricky---we'll memoize c23 with the wrong table that
69 # has the 5 already cached.
71 SCALAR_CACHE => [HASH => \%cache],
78 print (($t3 == 5) ? "ok $testno\n" : "not ok $testno\n");
80 print (($t4 == 5) ? "ok $testno\n" : "not ok $testno\n");