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