2 # -*- mode: perl; perl-indent-level: 2 -*-
5 use Memoize 0.45 qw(memoize unmemoize);
6 # use Memoize::Storable;
7 # $Memoize::Storable::Verbose = 0;
23 eval {require Storable};
32 if (eval {require File::Spec::Functions}) {
33 File::Spec::Functions->import();
35 *catfile = sub { join '/', @_ };
37 $tmpdir = $ENV{TMP} || $ENV{TMPDIR} || '/tmp';
38 $file = catfile($tmpdir, "storable$$");
40 tryout('Memoize::Storable', $file, 1); # Test 1..4
44 my ($tiepack, $file, $testno) = @_;
48 SCALAR_CACHE => ['TIE', $tiepack, $file],
54 print (($t1 == 5) ? "ok $testno\n" : "not ok $testno\n");
56 print (($t2 == 5) ? "ok $testno\n" : "not ok $testno\n");
61 # Now something tricky---we'll memoize c23 with the wrong table that
62 # has the 5 already cached.
64 SCALAR_CACHE => ['TIE', $tiepack, $file],
71 print (($t3 == 5) ? "ok $testno\n" : "not ok $testno\n");
73 print (($t4 == 5) ? "ok $testno\n" : "not ok $testno\n");