1#!./perl 2 3BEGIN { 4 chdir 't'; 5 @INC = '../lib'; 6 require './test.pl'; 7} 8 9print "1..7\n"; 10 11{ 12 package TieAll; 13 # tie, track, and report what calls are made 14 my @calls; 15 sub AUTOLOAD { 16 for ($AUTOLOAD =~ /TieAll::(.*)/) { 17 if (/TIE/) { return bless {} } 18 elsif (/calls/) { return join ',', splice @calls } 19 else { 20 push @calls, $_; 21 # FETCHSIZE doesn't like undef 22 # if FIRSTKEY, see if NEXTKEY is also called 23 return 1 if /FETCHSIZE|FIRSTKEY/; 24 return; 25 } 26 } 27 } 28} 29 30tie $x, 'TieAll'; 31tie @x, 'TieAll'; 32tie %x, 'TieAll'; 33 34{our $x;} 35is(TieAll->calls, '', 'our $x has no runtime effect'); 36 37{our ($x);} 38is(TieAll->calls, '', 'our ($x) has no runtime effect'); 39 40{our %x;} 41is(TieAll->calls, '', 'our %x has no runtime effect'); 42 43{our (%x);} 44is(TieAll->calls, '', 'our (%x) has no runtime effect'); 45 46{our @x;} 47is(TieAll->calls, '', 'our @x has no runtime effect'); 48 49{our (@x);} 50is(TieAll->calls, '', 'our (@x) has no runtime effect'); 51 52 53$y = 1; 54{ 55 my $y = 2; 56 { 57 our $y = $y; 58 is($y, 2, 'our shouldnt be visible until introduced') 59 } 60} 61