3 # Copyright (c) 1995-2000, Raphael Manfredi
5 # You may redistribute only under the same terms as Perl 5, as specified
6 # in the README file that comes with the distribution.
10 # Tests ref to items in tied hash/array structures.
16 @INC = ('.', '../lib', '../ext/Storable/t');
20 require Config; import Config;
21 if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
22 print "1..0 # Skip: Storable was not built\n";
33 use Storable qw(dclone);
37 sub H::TIEHASH { bless \(my $x), "H" }
38 sub H::FETCH { $h_fetches++; $_[1] - 70 }
45 ok 1, $h_fetches == 0;
46 ok 2, $$ref2 eq $$ref;
48 ok 4, $h_fetches == 2;
52 sub A::TIEARRAY { bless \(my $x), "A" }
53 sub A::FETCH { $a_fetches++; $_[1] - 70 }
60 ok 5, $a_fetches == 0;
61 ok 6, $$ref2 eq $$ref;
63 # I don't understand why it's 3 and not 2
64 ok 8, $a_fetches == 3;