Commit | Line | Data |
---|---|---|
cb1ce608 YST |
1 | #!./perl |
2 | ||
3 | BEGIN { | |
4 | chdir 't'; | |
5 | @INC = '../lib'; | |
6 | require './test.pl'; | |
7 | } | |
8 | ||
8716503d | 9 | print "1..7\n"; |
cb1ce608 YST |
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 | ||
30 | tie $x, 'TieAll'; | |
31 | tie @x, 'TieAll'; | |
32 | tie %x, 'TieAll'; | |
33 | ||
34 | {our $x;} | |
35 | is(TieAll->calls, '', 'our $x has no runtime effect'); | |
c754c3d7 | 36 | |
cb1ce608 YST |
37 | {our ($x);} |
38 | is(TieAll->calls, '', 'our ($x) has no runtime effect'); | |
c754c3d7 | 39 | |
cb1ce608 YST |
40 | {our %x;} |
41 | is(TieAll->calls, '', 'our %x has no runtime effect'); | |
42 | ||
c754c3d7 YST |
43 | {our (%x);} |
44 | is(TieAll->calls, '', 'our (%x) has no runtime effect'); | |
45 | ||
46 | {our @x;} | |
47 | is(TieAll->calls, '', 'our @x has no runtime effect'); | |
48 | ||
49 | {our (@x);} | |
50 | is(TieAll->calls, '', 'our (@x) has no runtime effect'); | |
8716503d DM |
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 | } |