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.
15 require Config; import Config;
16 if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
17 print "1..0 # Skip: Storable was not built\n";
28 use Storable qw(dclone);
32 sub H::TIEHASH { bless \(my $x), "H" }
33 sub H::FETCH { $h_fetches++; $_[1] - 70 }
40 ok 1, $h_fetches == 0;
41 ok 2, $$ref2 eq $$ref;
43 ok 4, $h_fetches == 2;
47 sub A::TIEARRAY { bless \(my $x), "A" }
48 sub A::FETCH { $a_fetches++; $_[1] - 70 }
55 ok 5, $a_fetches == 0;
56 ok 6, $$ref2 eq $$ref;
58 # I don't understand why it's 3 and not 2
59 ok 8, $a_fetches == 3;