xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/lib/warnings/3both (revision 0:68f95e015346)
1*0Sstevel@tonic-gateCheck interaction of $^W and lexical
2*0Sstevel@tonic-gate
3*0Sstevel@tonic-gate__END__
4*0Sstevel@tonic-gate
5*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
6*0Sstevel@tonic-gatesub fred {
7*0Sstevel@tonic-gate    use warnings ;
8*0Sstevel@tonic-gate    my $b ;
9*0Sstevel@tonic-gate    chop $b ;
10*0Sstevel@tonic-gate}
11*0Sstevel@tonic-gate{ local $^W = 0 ;
12*0Sstevel@tonic-gate  fred() ;
13*0Sstevel@tonic-gate}
14*0Sstevel@tonic-gate
15*0Sstevel@tonic-gateEXPECT
16*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 6.
17*0Sstevel@tonic-gate########
18*0Sstevel@tonic-gate
19*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
20*0Sstevel@tonic-gatesub fred {
21*0Sstevel@tonic-gate    use warnings ;
22*0Sstevel@tonic-gate    my $b ;
23*0Sstevel@tonic-gate    chop $b ;
24*0Sstevel@tonic-gate}
25*0Sstevel@tonic-gate{ $^W = 0 ;
26*0Sstevel@tonic-gate  fred() ;
27*0Sstevel@tonic-gate}
28*0Sstevel@tonic-gate
29*0Sstevel@tonic-gateEXPECT
30*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 6.
31*0Sstevel@tonic-gate########
32*0Sstevel@tonic-gate
33*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
34*0Sstevel@tonic-gatesub fred {
35*0Sstevel@tonic-gate    no warnings ;
36*0Sstevel@tonic-gate    my $b ;
37*0Sstevel@tonic-gate    chop $b ;
38*0Sstevel@tonic-gate}
39*0Sstevel@tonic-gate{ local $^W = 1 ;
40*0Sstevel@tonic-gate  fred() ;
41*0Sstevel@tonic-gate}
42*0Sstevel@tonic-gate
43*0Sstevel@tonic-gateEXPECT
44*0Sstevel@tonic-gate
45*0Sstevel@tonic-gate########
46*0Sstevel@tonic-gate
47*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
48*0Sstevel@tonic-gatesub fred {
49*0Sstevel@tonic-gate    no warnings ;
50*0Sstevel@tonic-gate    my $b ;
51*0Sstevel@tonic-gate    chop $b ;
52*0Sstevel@tonic-gate}
53*0Sstevel@tonic-gate{ $^W = 1 ;
54*0Sstevel@tonic-gate  fred() ;
55*0Sstevel@tonic-gate}
56*0Sstevel@tonic-gate
57*0Sstevel@tonic-gateEXPECT
58*0Sstevel@tonic-gate
59*0Sstevel@tonic-gate########
60*0Sstevel@tonic-gate
61*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
62*0Sstevel@tonic-gateuse warnings ;
63*0Sstevel@tonic-gate$^W = 1 ;
64*0Sstevel@tonic-gatemy $b ;
65*0Sstevel@tonic-gatechop $b ;
66*0Sstevel@tonic-gateEXPECT
67*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 6.
68*0Sstevel@tonic-gate########
69*0Sstevel@tonic-gate
70*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
71*0Sstevel@tonic-gate$^W = 1 ;
72*0Sstevel@tonic-gateuse warnings ;
73*0Sstevel@tonic-gatemy $b ;
74*0Sstevel@tonic-gatechop $b ;
75*0Sstevel@tonic-gateEXPECT
76*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 6.
77*0Sstevel@tonic-gate########
78*0Sstevel@tonic-gate
79*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
80*0Sstevel@tonic-gate$^W = 1 ;
81*0Sstevel@tonic-gateno warnings ;
82*0Sstevel@tonic-gatemy $b ;
83*0Sstevel@tonic-gatechop $b ;
84*0Sstevel@tonic-gateEXPECT
85*0Sstevel@tonic-gate
86*0Sstevel@tonic-gate########
87*0Sstevel@tonic-gate
88*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
89*0Sstevel@tonic-gateno warnings ;
90*0Sstevel@tonic-gate$^W = 1 ;
91*0Sstevel@tonic-gatemy $b ;
92*0Sstevel@tonic-gatechop $b ;
93*0Sstevel@tonic-gateEXPECT
94*0Sstevel@tonic-gate
95*0Sstevel@tonic-gate########
96*0Sstevel@tonic-gate-w
97*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
98*0Sstevel@tonic-gateno warnings ;
99*0Sstevel@tonic-gatemy $b ;
100*0Sstevel@tonic-gatechop $b ;
101*0Sstevel@tonic-gateEXPECT
102*0Sstevel@tonic-gate
103*0Sstevel@tonic-gate########
104*0Sstevel@tonic-gate-w
105*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
106*0Sstevel@tonic-gateuse warnings ;
107*0Sstevel@tonic-gatemy $b ;
108*0Sstevel@tonic-gatechop $b ;
109*0Sstevel@tonic-gateEXPECT
110*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 5.
111*0Sstevel@tonic-gate########
112*0Sstevel@tonic-gate
113*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
114*0Sstevel@tonic-gatesub fred {
115*0Sstevel@tonic-gate    use warnings ;
116*0Sstevel@tonic-gate    my $b ;
117*0Sstevel@tonic-gate    chop $b ;
118*0Sstevel@tonic-gate}
119*0Sstevel@tonic-gateBEGIN {  $^W = 0 }
120*0Sstevel@tonic-gatefred() ;
121*0Sstevel@tonic-gateEXPECT
122*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 6.
123*0Sstevel@tonic-gate########
124*0Sstevel@tonic-gate
125*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
126*0Sstevel@tonic-gatesub fred {
127*0Sstevel@tonic-gate    no warnings ;
128*0Sstevel@tonic-gate    my $b ;
129*0Sstevel@tonic-gate    chop $b ;
130*0Sstevel@tonic-gate}
131*0Sstevel@tonic-gateBEGIN {  $^W = 1 }
132*0Sstevel@tonic-gatefred() ;
133*0Sstevel@tonic-gate
134*0Sstevel@tonic-gateEXPECT
135*0Sstevel@tonic-gate
136*0Sstevel@tonic-gate########
137*0Sstevel@tonic-gate
138*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
139*0Sstevel@tonic-gateuse warnings ;
140*0Sstevel@tonic-gateBEGIN {  $^W = 1 }
141*0Sstevel@tonic-gatemy $b ;
142*0Sstevel@tonic-gatechop $b ;
143*0Sstevel@tonic-gateEXPECT
144*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 6.
145*0Sstevel@tonic-gate########
146*0Sstevel@tonic-gate
147*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
148*0Sstevel@tonic-gateBEGIN {  $^W = 1 }
149*0Sstevel@tonic-gateuse warnings ;
150*0Sstevel@tonic-gatemy $b ;
151*0Sstevel@tonic-gatechop $b ;
152*0Sstevel@tonic-gateEXPECT
153*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 6.
154*0Sstevel@tonic-gate########
155*0Sstevel@tonic-gate
156*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
157*0Sstevel@tonic-gateBEGIN {  $^W = 1 }
158*0Sstevel@tonic-gateno warnings ;
159*0Sstevel@tonic-gatemy $b ;
160*0Sstevel@tonic-gatechop $b ;
161*0Sstevel@tonic-gateEXPECT
162*0Sstevel@tonic-gate
163*0Sstevel@tonic-gate########
164*0Sstevel@tonic-gate
165*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
166*0Sstevel@tonic-gateno warnings ;
167*0Sstevel@tonic-gateBEGIN {  $^W = 1 }
168*0Sstevel@tonic-gatemy $b ;
169*0Sstevel@tonic-gatechop $b ;
170*0Sstevel@tonic-gateEXPECT
171*0Sstevel@tonic-gate
172*0Sstevel@tonic-gate########
173*0Sstevel@tonic-gate
174*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
175*0Sstevel@tonic-gateBEGIN {  $^W = 1 }
176*0Sstevel@tonic-gate{
177*0Sstevel@tonic-gate    no warnings ;
178*0Sstevel@tonic-gate    my $b ;
179*0Sstevel@tonic-gate    chop $b ;
180*0Sstevel@tonic-gate}
181*0Sstevel@tonic-gatemy $b ;
182*0Sstevel@tonic-gatechop $b ;
183*0Sstevel@tonic-gateEXPECT
184*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 10.
185*0Sstevel@tonic-gate########
186*0Sstevel@tonic-gate
187*0Sstevel@tonic-gate# Check interaction of $^W and use warnings
188*0Sstevel@tonic-gateBEGIN {  $^W = 0 }
189*0Sstevel@tonic-gate{
190*0Sstevel@tonic-gate    use warnings ;
191*0Sstevel@tonic-gate    my $b ;
192*0Sstevel@tonic-gate    chop $b ;
193*0Sstevel@tonic-gate}
194*0Sstevel@tonic-gatemy $b ;
195*0Sstevel@tonic-gatechop $b ;
196*0Sstevel@tonic-gateEXPECT
197*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 7.
198*0Sstevel@tonic-gate########
199*0Sstevel@tonic-gate
200*0Sstevel@tonic-gate# Check scope of pragma with eval
201*0Sstevel@tonic-gateBEGIN {  $^W = 1 }
202*0Sstevel@tonic-gate{
203*0Sstevel@tonic-gate    no warnings ;
204*0Sstevel@tonic-gate    eval '
205*0Sstevel@tonic-gate        my $b ; chop $b ;
206*0Sstevel@tonic-gate    '; print STDERR $@ ;
207*0Sstevel@tonic-gate    my $b ; chop $b ;
208*0Sstevel@tonic-gate}
209*0Sstevel@tonic-gateEXPECT
210*0Sstevel@tonic-gate
211*0Sstevel@tonic-gate########
212*0Sstevel@tonic-gate
213*0Sstevel@tonic-gate# Check scope of pragma with eval
214*0Sstevel@tonic-gateBEGIN {  $^W = 1 }
215*0Sstevel@tonic-gateuse warnings;
216*0Sstevel@tonic-gate{
217*0Sstevel@tonic-gate    no warnings ;
218*0Sstevel@tonic-gate    eval q[
219*0Sstevel@tonic-gate        use warnings 'uninitialized' ;
220*0Sstevel@tonic-gate        my $b ; chop $b ;
221*0Sstevel@tonic-gate    ]; print STDERR $@;
222*0Sstevel@tonic-gate    my $b ; chop $b ;
223*0Sstevel@tonic-gate}
224*0Sstevel@tonic-gateEXPECT
225*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at (eval 1) line 3.
226*0Sstevel@tonic-gate########
227*0Sstevel@tonic-gate
228*0Sstevel@tonic-gate# Check scope of pragma with eval
229*0Sstevel@tonic-gateBEGIN {  $^W = 0 }
230*0Sstevel@tonic-gate{
231*0Sstevel@tonic-gate    use warnings 'uninitialized' ;
232*0Sstevel@tonic-gate    eval '
233*0Sstevel@tonic-gate        my $b ; chop $b ;
234*0Sstevel@tonic-gate    '; print STDERR $@ ;
235*0Sstevel@tonic-gate    my $b ; chop $b ;
236*0Sstevel@tonic-gate}
237*0Sstevel@tonic-gateEXPECT
238*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at (eval 1) line 2.
239*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 9.
240*0Sstevel@tonic-gate########
241*0Sstevel@tonic-gate
242*0Sstevel@tonic-gate# Check scope of pragma with eval
243*0Sstevel@tonic-gateBEGIN {  $^W = 0 }
244*0Sstevel@tonic-gate{
245*0Sstevel@tonic-gate    use warnings 'uninitialized' ;
246*0Sstevel@tonic-gate    eval '
247*0Sstevel@tonic-gate        no warnings ;
248*0Sstevel@tonic-gate        my $b ; chop $b ;
249*0Sstevel@tonic-gate    '; print STDERR $@ ;
250*0Sstevel@tonic-gate    my $b ; chop $b ;
251*0Sstevel@tonic-gate}
252*0Sstevel@tonic-gateEXPECT
253*0Sstevel@tonic-gateUse of uninitialized value in scalar chop at - line 10.
254*0Sstevel@tonic-gate########
255*0Sstevel@tonic-gate
256*0Sstevel@tonic-gate# Check scope of pragma with eval
257*0Sstevel@tonic-gateBEGIN {  $^W = 1 }
258*0Sstevel@tonic-gate{
259*0Sstevel@tonic-gate    no warnings ;
260*0Sstevel@tonic-gate    eval '
261*0Sstevel@tonic-gate        my $a =+ 1 ;
262*0Sstevel@tonic-gate    '; print STDERR $@ ;
263*0Sstevel@tonic-gate    my $a =+ 1 ;
264*0Sstevel@tonic-gate}
265*0Sstevel@tonic-gateEXPECT
266*0Sstevel@tonic-gate
267