xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/lib/warnings/pad (revision 0:68f95e015346)
1*0Sstevel@tonic-gate  pad.c		AOK
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gate     "my" variable %s masks earlier declaration in same scope
4*0Sstevel@tonic-gate	my $x;
5*0Sstevel@tonic-gate	my $x ;
6*0Sstevel@tonic-gate
7*0Sstevel@tonic-gate     Variable "%s" may be unavailable
8*0Sstevel@tonic-gate	sub x {
9*0Sstevel@tonic-gate      	    my $x;
10*0Sstevel@tonic-gate      	    sub y {
11*0Sstevel@tonic-gate         	$x
12*0Sstevel@tonic-gate      	    }
13*0Sstevel@tonic-gate   	}
14*0Sstevel@tonic-gate
15*0Sstevel@tonic-gate     Variable "%s" will not stay shared
16*0Sstevel@tonic-gate	sub x {
17*0Sstevel@tonic-gate      	    my $x;
18*0Sstevel@tonic-gate      	    sub y {
19*0Sstevel@tonic-gate         	sub { $x }
20*0Sstevel@tonic-gate      	    }
21*0Sstevel@tonic-gate   	}
22*0Sstevel@tonic-gate    "our" variable %s redeclared	(Did you mean "local" instead of "our"?)
23*0Sstevel@tonic-gate	our $x;
24*0Sstevel@tonic-gate	{
25*0Sstevel@tonic-gate	    our $x;
26*0Sstevel@tonic-gate	}
27*0Sstevel@tonic-gate
28*0Sstevel@tonic-gate    %s never introduced		[pad_leavemy]	TODO
29*0Sstevel@tonic-gate
30*0Sstevel@tonic-gate__END__
31*0Sstevel@tonic-gate# pad.c
32*0Sstevel@tonic-gateuse warnings 'misc' ;
33*0Sstevel@tonic-gatemy $x ;
34*0Sstevel@tonic-gatemy $x ;
35*0Sstevel@tonic-gatemy $y = my $y ;
36*0Sstevel@tonic-gateno warnings 'misc' ;
37*0Sstevel@tonic-gatemy $x ;
38*0Sstevel@tonic-gatemy $y ;
39*0Sstevel@tonic-gateEXPECT
40*0Sstevel@tonic-gate"my" variable $x masks earlier declaration in same scope at - line 4.
41*0Sstevel@tonic-gate"my" variable $y masks earlier declaration in same statement at - line 5.
42*0Sstevel@tonic-gate########
43*0Sstevel@tonic-gate# pad.c
44*0Sstevel@tonic-gateuse warnings 'closure' ;
45*0Sstevel@tonic-gatesub x {
46*0Sstevel@tonic-gate      my $x;
47*0Sstevel@tonic-gate      sub y {
48*0Sstevel@tonic-gate         $x
49*0Sstevel@tonic-gate      }
50*0Sstevel@tonic-gate   }
51*0Sstevel@tonic-gateEXPECT
52*0Sstevel@tonic-gateVariable "$x" will not stay shared at - line 7.
53*0Sstevel@tonic-gate########
54*0Sstevel@tonic-gate# pad.c
55*0Sstevel@tonic-gateno warnings 'closure' ;
56*0Sstevel@tonic-gatesub x {
57*0Sstevel@tonic-gate      my $x;
58*0Sstevel@tonic-gate      sub y {
59*0Sstevel@tonic-gate         $x
60*0Sstevel@tonic-gate      }
61*0Sstevel@tonic-gate   }
62*0Sstevel@tonic-gateEXPECT
63*0Sstevel@tonic-gate
64*0Sstevel@tonic-gate########
65*0Sstevel@tonic-gate# pad.c
66*0Sstevel@tonic-gateuse warnings 'closure' ;
67*0Sstevel@tonic-gatesub x {
68*0Sstevel@tonic-gate      our $x;
69*0Sstevel@tonic-gate      sub y {
70*0Sstevel@tonic-gate         $x
71*0Sstevel@tonic-gate      }
72*0Sstevel@tonic-gate   }
73*0Sstevel@tonic-gateEXPECT
74*0Sstevel@tonic-gate
75*0Sstevel@tonic-gate########
76*0Sstevel@tonic-gate# pad.c
77*0Sstevel@tonic-gateuse warnings 'closure' ;
78*0Sstevel@tonic-gatesub x {
79*0Sstevel@tonic-gate      my $x;
80*0Sstevel@tonic-gate      sub y {
81*0Sstevel@tonic-gate         sub { $x }
82*0Sstevel@tonic-gate      }
83*0Sstevel@tonic-gate   }
84*0Sstevel@tonic-gateEXPECT
85*0Sstevel@tonic-gateVariable "$x" may be unavailable at - line 6.
86*0Sstevel@tonic-gate########
87*0Sstevel@tonic-gate# pad.c
88*0Sstevel@tonic-gateno warnings 'closure' ;
89*0Sstevel@tonic-gatesub x {
90*0Sstevel@tonic-gate      my $x;
91*0Sstevel@tonic-gate      sub y {
92*0Sstevel@tonic-gate         sub { $x }
93*0Sstevel@tonic-gate      }
94*0Sstevel@tonic-gate   }
95*0Sstevel@tonic-gateEXPECT
96*0Sstevel@tonic-gate
97*0Sstevel@tonic-gate########
98*0Sstevel@tonic-gateuse warnings 'misc' ;
99*0Sstevel@tonic-gateour $x;
100*0Sstevel@tonic-gate{
101*0Sstevel@tonic-gate    our $x;
102*0Sstevel@tonic-gate}
103*0Sstevel@tonic-gateEXPECT
104*0Sstevel@tonic-gate"our" variable $x redeclared at - line 4.
105*0Sstevel@tonic-gate	(Did you mean "local" instead of "our"?)
106*0Sstevel@tonic-gate########
107*0Sstevel@tonic-gate# an our var being introduced should suppress errors about global syms
108*0Sstevel@tonic-gateuse strict;
109*0Sstevel@tonic-gateuse warnings;
110*0Sstevel@tonic-gateour $x unless $x;
111*0Sstevel@tonic-gateEXPECT
112