11 print $@ ? "ok 1\n" : "not ok 1 # $@\n";
14 print $@ ? "ok 2\n" : "not ok 2 # $@\n";
16 eval { my $x; memoize(\$x) };
17 print $@ ? "ok 3\n" : "not ok 3 # $@\n";
21 my $dummyfile = './dummydb';
23 my %args = ( DB_File => [],
24 GDBM_File => [$dummyfile, 2, 0666],
25 ODBM_File => [$dummyfile, O_RDWR|O_CREAT, 0666],
26 NDBM_File => [$dummyfile, O_RDWR|O_CREAT, 0666],
27 SDBM_File => [$dummyfile, O_RDWR|O_CREAT, 0666],
29 for $mod (qw(DB_File GDBM_File SDBM_File ODBM_File NDBM_File)) {
32 tie my %cache => $mod, @{$args{$mod}};
33 memoize(sub {}, LIST_CACHE => [HASH => \%cache ]);
35 print $@ =~ /can only store scalars/
36 || $@ =~ /Can't locate.*in \@INC/
37 || $@ =~ /Can't load '.*?' for module/ ? "ok $n\n" : "not ok $n # $@\n";
38 1 while unlink $dummyfile, "$dummyfile.dir", "$dummyfile.pag", "$dummyfile.db";
44 memoize(sub {}, LIST_CACHE => ['TIE', 'WuggaWugga'])
46 print $@ ? "ok 9\n" : "not ok 9 # $@\n";
49 eval { memoize(sub {}, LIST_CACHE => 'YOB GORGLE') };
50 print $@ ? "ok 10\n" : "not ok 10 # $@\n";
53 eval { memoize(sub {}, SCALAR_CACHE => ['YOB GORGLE']) };
54 print $@ ? "ok 11\n" : "not ok 11 # $@\n";