3 # $Id: tied_items.t,v 1.0 2000/09/01 19:40:42 ram Exp $
5 # Copyright (c) 1995-2000, Raphael Manfredi
7 # You may redistribute only under the same terms as Perl 5, as specified
8 # in the README file that comes with the distribution.
10 # $Log: tied_items.t,v $
11 # Revision 1.0 2000/09/01 19:40:42 ram
12 # Baseline for first official release.
16 # Tests ref to items in tied hash/array structures.
23 require Config; import Config;
24 if ($Config{'extensions'} !~ /\bStorable\b/) {
25 print "1..0 # Skip: Storable was not built\n";
28 require 'lib/st-dump.pl';
36 use Storable qw(dclone);
40 sub H::TIEHASH { bless \(my $x), "H" }
41 sub H::FETCH { $h_fetches++; $_[1] - 70 }
48 ok 1, $h_fetches == 0;
49 ok 2, $$ref2 eq $$ref;
51 ok 4, $h_fetches == 2;
55 sub A::TIEARRAY { bless \(my $x), "A" }
56 sub A::FETCH { $a_fetches++; $_[1] - 70 }
63 ok 5, $a_fetches == 0;
64 ok 6, $$ref2 eq $$ref;
66 # I don't understand why it's 3 and not 2
67 ok 8, $a_fetches == 3;