3 # $Id: tied_items.t,v 0.7.1.2 2000/08/14 07:20:35 ram Exp $
5 # Copyright (c) 1995-2000, Raphael Manfredi
7 # You may redistribute only under the terms of the Artistic License,
8 # as specified in the README file that comes with the distribution.
10 # $Log: tied_items.t,v $
11 # Revision 0.7.1.2 2000/08/14 07:20:35 ram
12 # patch2: removed spurious dependency to Devel::Peek, used for testing only
14 # Revision 0.7.1.1 2000/08/13 20:10:31 ram
19 # Tests ref to items in tied hash/array structures.
24 unshift @INC, '../lib';
25 require Config; import Config;
26 if ($Config{'extensions'} !~ /\bStorable\b/) {
27 print "1..0 # Skip: Storable was not built\n";
30 require 'lib/st-dump.pl';
38 use Storable qw(dclone);
42 sub H::TIEHASH { bless \(my $x), "H" }
43 sub H::FETCH { $h_fetches++; $_[1] - 70 }
50 ok 1, $h_fetches == 0;
51 ok 2, $$ref2 eq $$ref;
53 ok 4, $h_fetches == 2;
57 sub A::TIEARRAY { bless \(my $x), "A" }
58 sub A::FETCH { $a_fetches++; $_[1] - 70 }
65 ok 5, $a_fetches == 0;
66 ok 6, $$ref2 eq $$ref;
68 # I don't understand why it's 3 and not 2
69 ok 8, $a_fetches == 3;