13 print $@ ? "ok 1\n" : "not ok 1 # $@\n";
16 print $@ ? "ok 2\n" : "not ok 2 # $@\n";
18 eval { my $x; memoize(\$x) };
19 print $@ ? "ok 3\n" : "not ok 3 # $@\n";
23 my $dummyfile = './dummydb';
25 my %args = ( DB_File => [],
26 GDBM_File => [$dummyfile, 2, 0666],
27 ODBM_File => [$dummyfile, O_RDWR|O_CREAT, 0666],
28 NDBM_File => [$dummyfile, O_RDWR|O_CREAT, 0666],
29 SDBM_File => [$dummyfile, O_RDWR|O_CREAT, 0666],
31 for $mod (qw(DB_File GDBM_File SDBM_File ODBM_File NDBM_File)) {
34 tie my %cache => $mod, @{$args{$mod}};
35 memoize(sub {}, LIST_CACHE => [HASH => \%cache ]);
37 print $@ =~ /can only store scalars/
38 || $@ =~ /Can't locate.*in \@INC/ ? "ok $n\n" : "not ok $n # $@\n";
39 1 while unlink $dummyfile, "$dummyfile.dir", "$dummyfile.pag", "$dummyfile.db";
45 memoize(sub {}, LIST_CACHE => ['TIE', 'WuggaWugga'])
47 print $@ ? "ok 9\n" : "not ok 9 # $@\n";
50 eval { memoize(sub {}, LIST_CACHE => 'YOB GORGLE') };
51 print $@ ? "ok 10\n" : "not ok 10 # $@\n";
54 eval { memoize(sub {}, SCALAR_CACHE => ['YOB GORGLE']) };
55 print $@ ? "ok 11\n" : "not ok 11 # $@\n";