Commit | Line | Data |
4438c4b7 |
1 | Check FATAL functionality |
2 | |
3 | __END__ |
4 | |
5 | # Check compile time warning |
551cd33c |
6 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
7 | { |
8 | no warnings ; |
551cd33c |
9 | $a =+ 1 ; |
4438c4b7 |
10 | } |
551cd33c |
11 | $a =+ 1 ; |
4438c4b7 |
12 | print STDERR "The End.\n" ; |
13 | EXPECT |
551cd33c |
14 | Reversed += operator at - line 8. |
4438c4b7 |
15 | ######## |
16 | |
d5a71f30 |
17 | # Check compile time warning |
18 | use warnings FATAL => 'all' ; |
19 | { |
20 | no warnings ; |
551cd33c |
21 | my $a =+ 1 ; |
d5a71f30 |
22 | } |
551cd33c |
23 | my $a =+ 1 ; |
d5a71f30 |
24 | print STDERR "The End.\n" ; |
25 | EXPECT |
551cd33c |
26 | Reversed += operator at - line 8. |
d5a71f30 |
27 | ######## |
28 | |
4438c4b7 |
29 | # Check runtime scope of pragma |
30 | use warnings FATAL => 'uninitialized' ; |
31 | { |
32 | no warnings ; |
33 | my $b ; chop $b ; |
34 | } |
35 | my $b ; chop $b ; |
36 | print STDERR "The End.\n" ; |
37 | EXPECT |
29489e7c |
38 | Use of uninitialized value $b in scalar chop at - line 8. |
4438c4b7 |
39 | ######## |
40 | |
41 | # Check runtime scope of pragma |
d5a71f30 |
42 | use warnings FATAL => 'all' ; |
43 | { |
44 | no warnings ; |
45 | my $b ; chop $b ; |
46 | } |
47 | my $b ; chop $b ; |
48 | print STDERR "The End.\n" ; |
49 | EXPECT |
29489e7c |
50 | Use of uninitialized value $b in scalar chop at - line 8. |
d5a71f30 |
51 | ######## |
52 | |
53 | # Check runtime scope of pragma |
4438c4b7 |
54 | no warnings ; |
55 | { |
56 | use warnings FATAL => 'uninitialized' ; |
57 | $a = sub { my $b ; chop $b ; } |
58 | } |
59 | &$a ; |
60 | print STDERR "The End.\n" ; |
61 | EXPECT |
29489e7c |
62 | Use of uninitialized value $b in scalar chop at - line 6. |
4438c4b7 |
63 | ######## |
d5a71f30 |
64 | |
65 | # Check runtime scope of pragma |
66 | no warnings ; |
67 | { |
68 | use warnings FATAL => 'all' ; |
69 | $a = sub { my $b ; chop $b ; } |
70 | } |
71 | &$a ; |
72 | print STDERR "The End.\n" ; |
73 | EXPECT |
29489e7c |
74 | Use of uninitialized value $b in scalar chop at - line 6. |
d5a71f30 |
75 | ######## |
4438c4b7 |
76 | |
77 | --FILE-- abc |
551cd33c |
78 | $a =+ 1 ; |
4438c4b7 |
79 | 1; |
80 | --FILE-- |
551cd33c |
81 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
82 | require "./abc"; |
83 | EXPECT |
84 | |
85 | ######## |
86 | |
87 | --FILE-- abc |
551cd33c |
88 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
89 | 1; |
90 | --FILE-- |
91 | require "./abc"; |
551cd33c |
92 | $a =+ 1 ; |
4438c4b7 |
93 | EXPECT |
94 | |
95 | ######## |
96 | |
97 | --FILE-- abc |
551cd33c |
98 | use warnings 'syntax' ; |
99 | $a =+ 1 ; |
4438c4b7 |
100 | 1; |
101 | --FILE-- |
102 | use warnings FATAL => 'uninitialized' ; |
103 | require "./abc"; |
104 | my $a ; chop $a ; |
105 | print STDERR "The End.\n" ; |
106 | EXPECT |
551cd33c |
107 | Reversed += operator at ./abc line 2. |
29489e7c |
108 | Use of uninitialized value $a in scalar chop at - line 3. |
4438c4b7 |
109 | ######## |
110 | |
111 | --FILE-- abc.pm |
551cd33c |
112 | use warnings 'syntax' ; |
113 | $a =+ 1 ; |
4438c4b7 |
114 | 1; |
115 | --FILE-- |
116 | use warnings FATAL => 'uninitialized' ; |
117 | use abc; |
118 | my $a ; chop $a ; |
119 | print STDERR "The End.\n" ; |
120 | EXPECT |
551cd33c |
121 | Reversed += operator at abc.pm line 2. |
29489e7c |
122 | Use of uninitialized value $a in scalar chop at - line 3. |
4438c4b7 |
123 | ######## |
124 | |
125 | # Check scope of pragma with eval |
126 | no warnings ; |
127 | eval { |
128 | use warnings FATAL => 'uninitialized' ; |
129 | my $b ; chop $b ; |
130 | }; print STDERR "-- $@" ; |
131 | my $b ; chop $b ; |
132 | print STDERR "The End.\n" ; |
133 | EXPECT |
29489e7c |
134 | -- Use of uninitialized value $b in scalar chop at - line 6. |
4438c4b7 |
135 | The End. |
136 | ######## |
137 | |
138 | # Check scope of pragma with eval |
139 | use warnings FATAL => 'uninitialized' ; |
140 | eval { |
141 | my $b ; chop $b ; |
142 | }; print STDERR "-- $@" ; |
143 | my $b ; chop $b ; |
144 | print STDERR "The End.\n" ; |
145 | EXPECT |
29489e7c |
146 | -- Use of uninitialized value $b in scalar chop at - line 5. |
147 | Use of uninitialized value $b in scalar chop at - line 7. |
4438c4b7 |
148 | ######## |
149 | |
150 | # Check scope of pragma with eval |
151 | use warnings FATAL => 'uninitialized' ; |
152 | eval { |
153 | no warnings ; |
154 | my $b ; chop $b ; |
155 | }; print STDERR $@ ; |
156 | my $b ; chop $b ; |
157 | print STDERR "The End.\n" ; |
158 | EXPECT |
29489e7c |
159 | Use of uninitialized value $b in scalar chop at - line 8. |
4438c4b7 |
160 | ######## |
161 | |
162 | # Check scope of pragma with eval |
163 | no warnings ; |
164 | eval { |
551cd33c |
165 | use warnings FATAL => 'syntax' ; |
166 | $a =+ 1 ; |
4438c4b7 |
167 | }; print STDERR "-- $@" ; |
551cd33c |
168 | $a =+ 1 ; |
4438c4b7 |
169 | print STDERR "The End.\n" ; |
170 | EXPECT |
551cd33c |
171 | Reversed += operator at - line 6. |
4438c4b7 |
172 | ######## |
173 | |
174 | # Check scope of pragma with eval |
551cd33c |
175 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
176 | eval { |
551cd33c |
177 | $a =+ 1 ; |
4438c4b7 |
178 | }; print STDERR "-- $@" ; |
551cd33c |
179 | $a =+ 1 ; |
4438c4b7 |
180 | print STDERR "The End.\n" ; |
181 | EXPECT |
551cd33c |
182 | Reversed += operator at - line 5. |
4438c4b7 |
183 | ######## |
184 | |
185 | # Check scope of pragma with eval |
551cd33c |
186 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
187 | eval { |
188 | no warnings ; |
551cd33c |
189 | $a =+ 1 ; |
4438c4b7 |
190 | }; print STDERR $@ ; |
551cd33c |
191 | $a =+ 1 ; |
4438c4b7 |
192 | print STDERR "The End.\n" ; |
193 | EXPECT |
551cd33c |
194 | Reversed += operator at - line 8. |
4438c4b7 |
195 | ######## |
196 | |
197 | # Check scope of pragma with eval |
198 | no warnings ; |
199 | eval { |
551cd33c |
200 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
201 | }; print STDERR $@ ; |
551cd33c |
202 | $a =+ 1 ; |
4438c4b7 |
203 | print STDERR "The End.\n" ; |
204 | EXPECT |
205 | The End. |
206 | ######## |
207 | |
208 | # Check scope of pragma with eval |
209 | no warnings ; |
210 | eval q[ |
211 | use warnings FATAL => 'uninitialized' ; |
212 | my $b ; chop $b ; |
213 | ]; print STDERR "-- $@"; |
214 | my $b ; chop $b ; |
215 | print STDERR "The End.\n" ; |
216 | EXPECT |
29489e7c |
217 | -- Use of uninitialized value $b in scalar chop at (eval 1) line 3. |
4438c4b7 |
218 | The End. |
219 | ######## |
220 | |
221 | # Check scope of pragma with eval |
222 | use warnings FATAL => 'uninitialized' ; |
223 | eval ' |
224 | my $b ; chop $b ; |
225 | '; print STDERR "-- $@" ; |
226 | my $b ; chop $b ; |
227 | print STDERR "The End.\n" ; |
228 | EXPECT |
29489e7c |
229 | -- Use of uninitialized value $b in scalar chop at (eval 1) line 2. |
230 | Use of uninitialized value $b in scalar chop at - line 7. |
4438c4b7 |
231 | ######## |
232 | |
233 | # Check scope of pragma with eval |
234 | use warnings FATAL => 'uninitialized' ; |
235 | eval ' |
236 | no warnings ; |
237 | my $b ; chop $b ; |
238 | '; print STDERR $@ ; |
239 | my $b ; chop $b ; |
240 | print STDERR "The End.\n" ; |
241 | EXPECT |
29489e7c |
242 | Use of uninitialized value $b in scalar chop at - line 8. |
4438c4b7 |
243 | ######## |
244 | |
245 | # Check scope of pragma with eval |
246 | no warnings ; |
247 | eval q[ |
551cd33c |
248 | use warnings FATAL => 'syntax' ; |
249 | $a =+ 1 ; |
4438c4b7 |
250 | ]; print STDERR "-- $@"; |
551cd33c |
251 | $a =+ 1 ; |
4438c4b7 |
252 | print STDERR "The End.\n" ; |
253 | EXPECT |
551cd33c |
254 | -- Reversed += operator at (eval 1) line 3. |
4438c4b7 |
255 | The End. |
256 | ######## |
257 | |
258 | # Check scope of pragma with eval |
551cd33c |
259 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
260 | eval ' |
551cd33c |
261 | $a =+ 1 ; |
4438c4b7 |
262 | '; print STDERR "-- $@"; |
263 | print STDERR "The End.\n" ; |
264 | EXPECT |
551cd33c |
265 | -- Reversed += operator at (eval 1) line 2. |
4438c4b7 |
266 | The End. |
267 | ######## |
268 | |
269 | # Check scope of pragma with eval |
551cd33c |
270 | use warnings FATAL => 'syntax' ; |
4438c4b7 |
271 | eval ' |
272 | no warnings ; |
551cd33c |
273 | $a =+ 1 ; |
4438c4b7 |
274 | '; print STDERR "-- $@"; |
551cd33c |
275 | $a =+ 1 ; |
4438c4b7 |
276 | print STDERR "The End.\n" ; |
277 | EXPECT |
551cd33c |
278 | Reversed += operator at - line 8. |
f1f33818 |
279 | ######## |
280 | |
281 | use warnings 'void' ; |
282 | |
283 | time ; |
284 | |
285 | { |
286 | use warnings FATAL => qw(void) ; |
287 | length "abc" ; |
288 | } |
289 | |
290 | join "", 1,2,3 ; |
291 | |
292 | print "done\n" ; |
293 | EXPECT |
294 | Useless use of time in void context at - line 4. |
295 | Useless use of length in void context at - line 8. |
296 | ######## |
297 | |
298 | use warnings ; |
299 | |
300 | time ; |
301 | |
302 | { |
303 | use warnings FATAL => qw(void) ; |
304 | length "abc" ; |
305 | } |
306 | |
307 | join "", 1,2,3 ; |
308 | |
309 | print "done\n" ; |
310 | EXPECT |
311 | Useless use of time in void context at - line 4. |
312 | Useless use of length in void context at - line 8. |
08540116 |
313 | ######## |
314 | |
315 | use warnings FATAL => 'all'; |
316 | { |
317 | no warnings; |
318 | my $b ; chop $b; |
319 | { |
320 | use warnings ; |
321 | my $b ; chop $b; |
322 | } |
323 | } |
324 | my $b ; chop $b; |
325 | print STDERR "The End.\n" ; |
326 | EXPECT |
29489e7c |
327 | Use of uninitialized value $b in scalar chop at - line 8. |
328 | Use of uninitialized value $b in scalar chop at - line 11. |
08540116 |
329 | ######## |
330 | |
331 | use warnings FATAL => 'all'; |
332 | { |
333 | no warnings FATAL => 'all'; |
334 | my $b ; chop $b; |
335 | { |
336 | use warnings ; |
337 | my $b ; chop $b; |
338 | } |
339 | } |
340 | my $b ; chop $b; |
341 | print STDERR "The End.\n" ; |
342 | EXPECT |
29489e7c |
343 | Use of uninitialized value $b in scalar chop at - line 8. |
344 | Use of uninitialized value $b in scalar chop at - line 11. |
08540116 |
345 | ######## |
346 | |
347 | use warnings FATAL => 'all'; |
348 | { |
349 | no warnings 'syntax'; |
350 | { |
351 | use warnings ; |
352 | my $b ; chop $b; |
353 | } |
354 | } |
355 | my $b ; chop $b; |
356 | print STDERR "The End.\n" ; |
357 | EXPECT |
29489e7c |
358 | Use of uninitialized value $b in scalar chop at - line 7. |
6e9af7e4 |
359 | ######## |
360 | |
361 | use warnings FATAL => 'syntax', NONFATAL => 'void' ; |
362 | |
363 | length "abc"; |
364 | print STDERR "The End.\n" ; |
365 | EXPECT |
366 | Useless use of length in void context at - line 4. |
367 | The End. |
368 | ######## |
369 | |
370 | use warnings FATAL => 'all', NONFATAL => 'void' ; |
371 | |
372 | length "abc"; |
373 | print STDERR "The End.\n" ; |
374 | EXPECT |
375 | Useless use of length in void context at - line 4. |
376 | The End. |
377 | ######## |
378 | |
379 | use warnings FATAL => 'all', NONFATAL => 'void' ; |
380 | |
381 | my $a ; chomp $a; |
382 | length "abc"; |
383 | print STDERR "The End.\n" ; |
384 | EXPECT |
385 | Useless use of length in void context at - line 5. |
29489e7c |
386 | Use of uninitialized value $a in scalar chomp at - line 4. |
6e9af7e4 |
387 | ######## |
388 | |
389 | use warnings FATAL => 'void', NONFATAL => 'void' ; |
390 | |
391 | length "abc"; |
392 | print STDERR "The End.\n" ; |
393 | EXPECT |
394 | Useless use of length in void context at - line 4. |
395 | The End. |
396 | ######## |
397 | |
398 | use warnings NONFATAL => 'void', FATAL => 'void' ; |
399 | |
400 | length "abc"; |
401 | print STDERR "The End.\n" ; |
402 | EXPECT |
403 | Useless use of length in void context at - line 4. |
404 | ######## |
405 | |
406 | use warnings FATAL => 'all', NONFATAL => 'io'; |
407 | no warnings 'once'; |
408 | |
409 | open(F, "<true\ncd"); |
410 | close "fred" ; |
411 | print STDERR "The End.\n" ; |
412 | EXPECT |
413 | Unsuccessful open on filename containing newline at - line 5. |
414 | close() on unopened filehandle fred at - line 6. |
415 | The End. |
416 | ######## |
417 | |
418 | use warnings FATAL => 'all', NONFATAL => 'io', FATAL => 'unopened' ; |
419 | no warnings 'once'; |
420 | |
421 | open(F, "<true\ncd"); |
422 | close "fred" ; |
423 | print STDERR "The End.\n" ; |
424 | EXPECT |
425 | Unsuccessful open on filename containing newline at - line 5. |
426 | close() on unopened filehandle fred at - line 6. |