Commit | Line | Data |
599cee73 |
1 | op.c AOK |
2 | |
3 | "my" variable %s masks earlier declaration in same scope |
4 | my $x; |
5 | my $x ; |
6 | |
7 | Variable "%s" may be unavailable |
8 | sub x { |
9 | my $x; |
10 | sub y { |
11 | $x |
12 | } |
13 | } |
14 | |
15 | Variable "%s" will not stay shared |
16 | sub x { |
17 | my $x; |
18 | sub y { |
19 | sub { $x } |
20 | } |
21 | } |
22 | |
23 | Found = in conditional, should be == |
24 | 1 if $a = 1 ; |
25 | |
26 | Use of implicit split to @_ is deprecated |
27 | split ; |
28 | |
29 | Use of implicit split to @_ is deprecated |
30 | $a = split ; |
31 | |
32 | Useless use of time in void context |
33 | Useless use of a variable in void context |
34 | Useless use of a constant in void context |
35 | time ; |
36 | $a ; |
37 | "abc" |
38 | |
a801c63c |
39 | Useless use of sort in scalar context |
40 | my $x = sort (2,1,3); |
41 | |
599cee73 |
42 | Applying %s to %s will act on scalar(%s) |
43 | my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ; |
44 | @a =~ /abc/ ; |
45 | @a =~ s/a/b/ ; |
46 | @a =~ tr/a/b/ ; |
47 | @$b =~ /abc/ ; |
48 | @$b =~ s/a/b/ ; |
49 | @$b =~ tr/a/b/ ; |
50 | %a =~ /abc/ ; |
51 | %a =~ s/a/b/ ; |
52 | %a =~ tr/a/b/ ; |
53 | %$c =~ /abc/ ; |
54 | %$c =~ s/a/b/ ; |
55 | %$c =~ tr/a/b/ ; |
56 | |
57 | |
df5b6949 |
58 | Parentheses missing around "my" list at -e line 1. |
599cee73 |
59 | my $a, $b = (1,2); |
60 | |
df5b6949 |
61 | Parentheses missing around "local" list at -e line 1. |
599cee73 |
62 | local $a, $b = (1,2); |
63 | |
34d09196 |
64 | Bareword found in conditional at -e line 1. |
e476b1b5 |
65 | use warnings 'bareword'; my $x = print(ABC || 1); |
599cee73 |
66 | |
67 | Value of %s may be \"0\"; use \"defined\" |
68 | $x = 1 if $x = <FH> ; |
69 | $x = 1 while $x = <FH> ; |
70 | |
71 | Subroutine fred redefined at -e line 1. |
72 | sub fred{1;} sub fred{1;} |
73 | |
74 | Constant subroutine %s redefined |
75 | sub fred() {1;} sub fred() {1;} |
76 | |
77 | Format FRED redefined at /tmp/x line 5. |
78 | format FRED = |
79 | . |
80 | format FRED = |
81 | . |
82 | |
83 | Array @%s missing the @ in argument %d of %s() |
84 | push fred ; |
85 | |
86 | Hash %%%s missing the %% in argument %d of %s() |
87 | keys joe ; |
88 | |
89 | Statement unlikely to be reached |
cc507455 |
90 | (Maybe you meant system() when you said exec()? |
599cee73 |
91 | exec "true" ; my $a |
92 | |
f10b0346 |
93 | defined(@array) is deprecated |
cc507455 |
94 | (Maybe you should just omit the defined()?) |
69794302 |
95 | my @a ; defined @a ; |
96 | defined (@a = (1,2,3)) ; |
97 | |
f10b0346 |
98 | defined(%hash) is deprecated |
cc507455 |
99 | (Maybe you should just omit the defined()?) |
69794302 |
100 | my %h ; defined %h ; |
eb6e2d6f |
101 | |
102 | /---/ should probably be written as "---" |
103 | join(/---/, @foo); |
599cee73 |
104 | |
767a6a26 |
105 | %s() called too early to check prototype [Perl_peep] |
106 | fred() ; sub fred ($$) {} |
107 | |
108 | |
f2c0fa37 |
109 | Use of "package" with no arguments is deprecated |
110 | package; |
111 | |
3b434eb1 |
112 | Package `%s' not found (did you use the incorrect case?) |
113 | |
0453d815 |
114 | Mandatory Warnings |
115 | ------------------ |
116 | Prototype mismatch: [cv_ckproto] |
117 | sub fred() ; |
118 | sub fred($) {} |
119 | |
120 | %s never introduced [pad_leavemy] TODO |
121 | Runaway prototype [newSUB] TODO |
122 | oops: oopsAV [oopsAV] TODO |
123 | oops: oopsHV [oopsHV] TODO |
124 | |
0453d815 |
125 | |
599cee73 |
126 | __END__ |
127 | # op.c |
e476b1b5 |
128 | use warnings 'misc' ; |
599cee73 |
129 | my $x ; |
130 | my $x ; |
e476b1b5 |
131 | no warnings 'misc' ; |
0453d815 |
132 | my $x ; |
599cee73 |
133 | EXPECT |
134 | "my" variable $x masks earlier declaration in same scope at - line 4. |
135 | ######## |
136 | # op.c |
e476b1b5 |
137 | use warnings 'closure' ; |
599cee73 |
138 | sub x { |
139 | my $x; |
140 | sub y { |
141 | $x |
142 | } |
143 | } |
144 | EXPECT |
145 | Variable "$x" will not stay shared at - line 7. |
146 | ######## |
147 | # op.c |
e476b1b5 |
148 | no warnings 'closure' ; |
0453d815 |
149 | sub x { |
150 | my $x; |
151 | sub y { |
152 | $x |
153 | } |
154 | } |
155 | EXPECT |
156 | |
157 | ######## |
158 | # op.c |
e476b1b5 |
159 | use warnings 'closure' ; |
599cee73 |
160 | sub x { |
741b6338 |
161 | our $x; |
162 | sub y { |
163 | $x |
164 | } |
165 | } |
166 | EXPECT |
167 | |
168 | ######## |
169 | # op.c |
170 | use warnings 'closure' ; |
171 | sub x { |
599cee73 |
172 | my $x; |
173 | sub y { |
174 | sub { $x } |
175 | } |
176 | } |
177 | EXPECT |
178 | Variable "$x" may be unavailable at - line 6. |
179 | ######## |
180 | # op.c |
e476b1b5 |
181 | no warnings 'closure' ; |
0453d815 |
182 | sub x { |
183 | my $x; |
184 | sub y { |
185 | sub { $x } |
186 | } |
187 | } |
188 | EXPECT |
189 | |
190 | ######## |
191 | # op.c |
4438c4b7 |
192 | use warnings 'syntax' ; |
599cee73 |
193 | 1 if $a = 1 ; |
4438c4b7 |
194 | no warnings 'syntax' ; |
0453d815 |
195 | 1 if $a = 1 ; |
599cee73 |
196 | EXPECT |
197 | Found = in conditional, should be == at - line 3. |
198 | ######## |
199 | # op.c |
4438c4b7 |
200 | use warnings 'deprecated' ; |
599cee73 |
201 | split ; |
4438c4b7 |
202 | no warnings 'deprecated' ; |
0453d815 |
203 | split ; |
599cee73 |
204 | EXPECT |
205 | Use of implicit split to @_ is deprecated at - line 3. |
206 | ######## |
207 | # op.c |
4438c4b7 |
208 | use warnings 'deprecated' ; |
599cee73 |
209 | $a = split ; |
4438c4b7 |
210 | no warnings 'deprecated' ; |
0453d815 |
211 | $a = split ; |
599cee73 |
212 | EXPECT |
213 | Use of implicit split to @_ is deprecated at - line 3. |
214 | ######## |
215 | # op.c |
a1063b2d |
216 | use warnings 'deprecated'; |
217 | my (@foo, %foo); |
218 | %main::foo->{"bar"}; |
219 | %foo->{"bar"}; |
220 | @main::foo->[23]; |
221 | @foo->[23]; |
222 | $main::foo = {}; %$main::foo->{"bar"}; |
223 | $foo = {}; %$foo->{"bar"}; |
224 | $main::foo = []; @$main::foo->[34]; |
225 | $foo = []; @$foo->[34]; |
226 | no warnings 'deprecated'; |
227 | %main::foo->{"bar"}; |
228 | %foo->{"bar"}; |
229 | @main::foo->[23]; |
230 | @foo->[23]; |
231 | $main::foo = {}; %$main::foo->{"bar"}; |
232 | $foo = {}; %$foo->{"bar"}; |
233 | $main::foo = []; @$main::foo->[34]; |
234 | $foo = []; @$foo->[34]; |
235 | EXPECT |
236 | Using a hash as a reference is deprecated at - line 4. |
237 | Using a hash as a reference is deprecated at - line 5. |
238 | Using an array as a reference is deprecated at - line 6. |
239 | Using an array as a reference is deprecated at - line 7. |
240 | Using a hash as a reference is deprecated at - line 8. |
241 | Using a hash as a reference is deprecated at - line 9. |
242 | Using an array as a reference is deprecated at - line 10. |
243 | Using an array as a reference is deprecated at - line 11. |
244 | ######## |
245 | # op.c |
4438c4b7 |
246 | use warnings 'void' ; close STDIN ; |
599cee73 |
247 | 1 x 3 ; # OP_REPEAT |
248 | # OP_GVSV |
249 | wantarray ; # OP_WANTARRAY |
250 | # OP_GV |
251 | # OP_PADSV |
252 | # OP_PADAV |
253 | # OP_PADHV |
254 | # OP_PADANY |
255 | # OP_AV2ARYLEN |
256 | ref ; # OP_REF |
257 | \@a ; # OP_REFGEN |
258 | \$a ; # OP_SREFGEN |
259 | defined $a ; # OP_DEFINED |
260 | hex $a ; # OP_HEX |
261 | oct $a ; # OP_OCT |
262 | length $a ; # OP_LENGTH |
263 | substr $a,1 ; # OP_SUBSTR |
264 | vec $a,1,2 ; # OP_VEC |
265 | index $a,1,2 ; # OP_INDEX |
266 | rindex $a,1,2 ; # OP_RINDEX |
267 | sprintf $a ; # OP_SPRINTF |
268 | $a[0] ; # OP_AELEM |
269 | # OP_AELEMFAST |
270 | @a[0] ; # OP_ASLICE |
271 | #values %a ; # OP_VALUES |
272 | #keys %a ; # OP_KEYS |
273 | $a{0} ; # OP_HELEM |
274 | @a{0} ; # OP_HSLICE |
275 | unpack "a", "a" ; # OP_UNPACK |
276 | pack $a,"" ; # OP_PACK |
277 | join "" ; # OP_JOIN |
278 | (@a)[0,1] ; # OP_LSLICE |
279 | # OP_ANONLIST |
280 | # OP_ANONHASH |
281 | sort(1,2) ; # OP_SORT |
282 | reverse(1,2) ; # OP_REVERSE |
283 | # OP_RANGE |
284 | # OP_FLIP |
285 | (1 ..2) ; # OP_FLOP |
286 | caller ; # OP_CALLER |
287 | fileno STDIN ; # OP_FILENO |
288 | eof STDIN ; # OP_EOF |
289 | tell STDIN ; # OP_TELL |
290 | readlink 1; # OP_READLINK |
291 | time ; # OP_TIME |
292 | localtime ; # OP_LOCALTIME |
293 | gmtime ; # OP_GMTIME |
dfe13c55 |
294 | eval { getgrnam 1 }; # OP_GGRNAM |
295 | eval { getgrgid 1 }; # OP_GGRGID |
296 | eval { getpwnam 1 }; # OP_GPWNAM |
297 | eval { getpwuid 1 }; # OP_GPWUID |
599cee73 |
298 | EXPECT |
42d38218 |
299 | Useless use of repeat (x) in void context at - line 3. |
599cee73 |
300 | Useless use of wantarray in void context at - line 5. |
301 | Useless use of reference-type operator in void context at - line 12. |
302 | Useless use of reference constructor in void context at - line 13. |
d6c467eb |
303 | Useless use of single ref constructor in void context at - line 14. |
599cee73 |
304 | Useless use of defined operator in void context at - line 15. |
305 | Useless use of hex in void context at - line 16. |
306 | Useless use of oct in void context at - line 17. |
307 | Useless use of length in void context at - line 18. |
308 | Useless use of substr in void context at - line 19. |
309 | Useless use of vec in void context at - line 20. |
310 | Useless use of index in void context at - line 21. |
311 | Useless use of rindex in void context at - line 22. |
312 | Useless use of sprintf in void context at - line 23. |
313 | Useless use of array element in void context at - line 24. |
314 | Useless use of array slice in void context at - line 26. |
f1612b5c |
315 | Useless use of hash element in void context at - line 29. |
599cee73 |
316 | Useless use of hash slice in void context at - line 30. |
317 | Useless use of unpack in void context at - line 31. |
318 | Useless use of pack in void context at - line 32. |
297b36dc |
319 | Useless use of join or string in void context at - line 33. |
599cee73 |
320 | Useless use of list slice in void context at - line 34. |
321 | Useless use of sort in void context at - line 37. |
322 | Useless use of reverse in void context at - line 38. |
323 | Useless use of range (or flop) in void context at - line 41. |
324 | Useless use of caller in void context at - line 42. |
325 | Useless use of fileno in void context at - line 43. |
326 | Useless use of eof in void context at - line 44. |
327 | Useless use of tell in void context at - line 45. |
328 | Useless use of readlink in void context at - line 46. |
329 | Useless use of time in void context at - line 47. |
330 | Useless use of localtime in void context at - line 48. |
331 | Useless use of gmtime in void context at - line 49. |
332 | Useless use of getgrnam in void context at - line 50. |
333 | Useless use of getgrgid in void context at - line 51. |
334 | Useless use of getpwnam in void context at - line 52. |
335 | Useless use of getpwuid in void context at - line 53. |
336 | ######## |
337 | # op.c |
a801c63c |
338 | use warnings 'void' ; close STDIN ; |
339 | my $x = sort (2,1,3); |
340 | no warnings 'void' ; |
341 | $x = sort (2,1,3); |
342 | EXPECT |
343 | Useless use of sort in scalar context at - line 3. |
344 | ######## |
345 | # op.c |
4438c4b7 |
346 | no warnings 'void' ; close STDIN ; |
0453d815 |
347 | 1 x 3 ; # OP_REPEAT |
348 | # OP_GVSV |
349 | wantarray ; # OP_WANTARRAY |
350 | # OP_GV |
351 | # OP_PADSV |
352 | # OP_PADAV |
353 | # OP_PADHV |
354 | # OP_PADANY |
355 | # OP_AV2ARYLEN |
356 | ref ; # OP_REF |
357 | \@a ; # OP_REFGEN |
358 | \$a ; # OP_SREFGEN |
359 | defined $a ; # OP_DEFINED |
360 | hex $a ; # OP_HEX |
361 | oct $a ; # OP_OCT |
362 | length $a ; # OP_LENGTH |
363 | substr $a,1 ; # OP_SUBSTR |
364 | vec $a,1,2 ; # OP_VEC |
365 | index $a,1,2 ; # OP_INDEX |
366 | rindex $a,1,2 ; # OP_RINDEX |
367 | sprintf $a ; # OP_SPRINTF |
368 | $a[0] ; # OP_AELEM |
369 | # OP_AELEMFAST |
370 | @a[0] ; # OP_ASLICE |
371 | #values %a ; # OP_VALUES |
372 | #keys %a ; # OP_KEYS |
373 | $a{0} ; # OP_HELEM |
374 | @a{0} ; # OP_HSLICE |
375 | unpack "a", "a" ; # OP_UNPACK |
376 | pack $a,"" ; # OP_PACK |
377 | join "" ; # OP_JOIN |
378 | (@a)[0,1] ; # OP_LSLICE |
379 | # OP_ANONLIST |
380 | # OP_ANONHASH |
381 | sort(1,2) ; # OP_SORT |
382 | reverse(1,2) ; # OP_REVERSE |
383 | # OP_RANGE |
384 | # OP_FLIP |
385 | (1 ..2) ; # OP_FLOP |
386 | caller ; # OP_CALLER |
387 | fileno STDIN ; # OP_FILENO |
388 | eof STDIN ; # OP_EOF |
389 | tell STDIN ; # OP_TELL |
390 | readlink 1; # OP_READLINK |
391 | time ; # OP_TIME |
392 | localtime ; # OP_LOCALTIME |
393 | gmtime ; # OP_GMTIME |
394 | eval { getgrnam 1 }; # OP_GGRNAM |
395 | eval { getgrgid 1 }; # OP_GGRGID |
396 | eval { getpwnam 1 }; # OP_GPWNAM |
397 | eval { getpwuid 1 }; # OP_GPWUID |
398 | EXPECT |
399 | ######## |
400 | # op.c |
4438c4b7 |
401 | use warnings 'void' ; |
68c73484 |
402 | for (@{[0]}) { "$_" } # check warning isn't duplicated |
4438c4b7 |
403 | no warnings 'void' ; |
0453d815 |
404 | for (@{[0]}) { "$_" } # check warning isn't duplicated |
68c73484 |
405 | EXPECT |
406 | Useless use of string in void context at - line 3. |
407 | ######## |
408 | # op.c |
4438c4b7 |
409 | use warnings 'void' ; |
599cee73 |
410 | use Config ; |
411 | BEGIN { |
412 | if ( ! $Config{d_telldir}) { |
413 | print <<EOM ; |
414 | SKIPPED |
415 | # telldir not present |
416 | EOM |
417 | exit |
418 | } |
419 | } |
420 | telldir 1 ; # OP_TELLDIR |
4438c4b7 |
421 | no warnings 'void' ; |
0453d815 |
422 | telldir 1 ; # OP_TELLDIR |
599cee73 |
423 | EXPECT |
424 | Useless use of telldir in void context at - line 13. |
425 | ######## |
426 | # op.c |
4438c4b7 |
427 | use warnings 'void' ; |
599cee73 |
428 | use Config ; |
429 | BEGIN { |
430 | if ( ! $Config{d_getppid}) { |
431 | print <<EOM ; |
432 | SKIPPED |
433 | # getppid not present |
434 | EOM |
435 | exit |
436 | } |
437 | } |
438 | getppid ; # OP_GETPPID |
4438c4b7 |
439 | no warnings 'void' ; |
0453d815 |
440 | getppid ; # OP_GETPPID |
599cee73 |
441 | EXPECT |
442 | Useless use of getppid in void context at - line 13. |
443 | ######## |
444 | # op.c |
4438c4b7 |
445 | use warnings 'void' ; |
599cee73 |
446 | use Config ; |
447 | BEGIN { |
448 | if ( ! $Config{d_getpgrp}) { |
449 | print <<EOM ; |
450 | SKIPPED |
451 | # getpgrp not present |
452 | EOM |
453 | exit |
454 | } |
455 | } |
456 | getpgrp ; # OP_GETPGRP |
4438c4b7 |
457 | no warnings 'void' ; |
0453d815 |
458 | getpgrp ; # OP_GETPGRP |
599cee73 |
459 | EXPECT |
460 | Useless use of getpgrp in void context at - line 13. |
461 | ######## |
462 | # op.c |
4438c4b7 |
463 | use warnings 'void' ; |
599cee73 |
464 | use Config ; |
465 | BEGIN { |
466 | if ( ! $Config{d_times}) { |
467 | print <<EOM ; |
468 | SKIPPED |
469 | # times not present |
470 | EOM |
471 | exit |
472 | } |
473 | } |
474 | times ; # OP_TMS |
4438c4b7 |
475 | no warnings 'void' ; |
0453d815 |
476 | times ; # OP_TMS |
599cee73 |
477 | EXPECT |
478 | Useless use of times in void context at - line 13. |
479 | ######## |
480 | # op.c |
4438c4b7 |
481 | use warnings 'void' ; |
599cee73 |
482 | use Config ; |
483 | BEGIN { |
e96326af |
484 | if ( ! $Config{d_getprior} or $^O eq 'os2') { # Locks before fixpak22 |
599cee73 |
485 | print <<EOM ; |
486 | SKIPPED |
487 | # getpriority not present |
488 | EOM |
489 | exit |
490 | } |
491 | } |
492 | getpriority 1,2; # OP_GETPRIORITY |
4438c4b7 |
493 | no warnings 'void' ; |
0453d815 |
494 | getpriority 1,2; # OP_GETPRIORITY |
599cee73 |
495 | EXPECT |
496 | Useless use of getpriority in void context at - line 13. |
497 | ######## |
498 | # op.c |
4438c4b7 |
499 | use warnings 'void' ; |
599cee73 |
500 | use Config ; |
501 | BEGIN { |
502 | if ( ! $Config{d_getlogin}) { |
503 | print <<EOM ; |
504 | SKIPPED |
505 | # getlogin not present |
506 | EOM |
507 | exit |
508 | } |
509 | } |
510 | getlogin ; # OP_GETLOGIN |
4438c4b7 |
511 | no warnings 'void' ; |
0453d815 |
512 | getlogin ; # OP_GETLOGIN |
599cee73 |
513 | EXPECT |
514 | Useless use of getlogin in void context at - line 13. |
515 | ######## |
516 | # op.c |
4438c4b7 |
517 | use warnings 'void' ; |
599cee73 |
518 | use Config ; BEGIN { |
519 | if ( ! $Config{d_socket}) { |
520 | print <<EOM ; |
521 | SKIPPED |
522 | # getsockname not present |
523 | # getpeername not present |
524 | # gethostbyname not present |
525 | # gethostbyaddr not present |
526 | # gethostent not present |
527 | # getnetbyname not present |
528 | # getnetbyaddr not present |
529 | # getnetent not present |
530 | # getprotobyname not present |
531 | # getprotobynumber not present |
532 | # getprotoent not present |
533 | # getservbyname not present |
534 | # getservbyport not present |
535 | # getservent not present |
536 | EOM |
537 | exit |
538 | } } |
539 | getsockname STDIN ; # OP_GETSOCKNAME |
540 | getpeername STDIN ; # OP_GETPEERNAME |
541 | gethostbyname 1 ; # OP_GHBYNAME |
542 | gethostbyaddr 1,2; # OP_GHBYADDR |
543 | gethostent ; # OP_GHOSTENT |
544 | getnetbyname 1 ; # OP_GNBYNAME |
545 | getnetbyaddr 1,2 ; # OP_GNBYADDR |
546 | getnetent ; # OP_GNETENT |
547 | getprotobyname 1; # OP_GPBYNAME |
548 | getprotobynumber 1; # OP_GPBYNUMBER |
549 | getprotoent ; # OP_GPROTOENT |
550 | getservbyname 1,2; # OP_GSBYNAME |
551 | getservbyport 1,2; # OP_GSBYPORT |
552 | getservent ; # OP_GSERVENT |
0453d815 |
553 | |
4438c4b7 |
554 | no warnings 'void' ; |
0453d815 |
555 | getsockname STDIN ; # OP_GETSOCKNAME |
556 | getpeername STDIN ; # OP_GETPEERNAME |
557 | gethostbyname 1 ; # OP_GHBYNAME |
558 | gethostbyaddr 1,2; # OP_GHBYADDR |
559 | gethostent ; # OP_GHOSTENT |
560 | getnetbyname 1 ; # OP_GNBYNAME |
561 | getnetbyaddr 1,2 ; # OP_GNBYADDR |
562 | getnetent ; # OP_GNETENT |
563 | getprotobyname 1; # OP_GPBYNAME |
564 | getprotobynumber 1; # OP_GPBYNUMBER |
565 | getprotoent ; # OP_GPROTOENT |
566 | getservbyname 1,2; # OP_GSBYNAME |
567 | getservbyport 1,2; # OP_GSBYPORT |
568 | getservent ; # OP_GSERVENT |
dfe13c55 |
569 | INIT { |
570 | # some functions may not be there, so we exit without running |
571 | exit; |
572 | } |
599cee73 |
573 | EXPECT |
574 | Useless use of getsockname in void context at - line 24. |
575 | Useless use of getpeername in void context at - line 25. |
576 | Useless use of gethostbyname in void context at - line 26. |
577 | Useless use of gethostbyaddr in void context at - line 27. |
578 | Useless use of gethostent in void context at - line 28. |
579 | Useless use of getnetbyname in void context at - line 29. |
580 | Useless use of getnetbyaddr in void context at - line 30. |
581 | Useless use of getnetent in void context at - line 31. |
582 | Useless use of getprotobyname in void context at - line 32. |
583 | Useless use of getprotobynumber in void context at - line 33. |
584 | Useless use of getprotoent in void context at - line 34. |
585 | Useless use of getservbyname in void context at - line 35. |
586 | Useless use of getservbyport in void context at - line 36. |
587 | Useless use of getservent in void context at - line 37. |
588 | ######## |
589 | # op.c |
4438c4b7 |
590 | use warnings 'void' ; |
599cee73 |
591 | *a ; # OP_RV2GV |
592 | $a ; # OP_RV2SV |
593 | @a ; # OP_RV2AV |
594 | %a ; # OP_RV2HV |
4438c4b7 |
595 | no warnings 'void' ; |
0453d815 |
596 | *a ; # OP_RV2GV |
597 | $a ; # OP_RV2SV |
598 | @a ; # OP_RV2AV |
599 | %a ; # OP_RV2HV |
599cee73 |
600 | EXPECT |
601 | Useless use of a variable in void context at - line 3. |
602 | Useless use of a variable in void context at - line 4. |
603 | Useless use of a variable in void context at - line 5. |
604 | Useless use of a variable in void context at - line 6. |
605 | ######## |
606 | # op.c |
4438c4b7 |
607 | use warnings 'void' ; |
599cee73 |
608 | "abc"; # OP_CONST |
609 | 7 ; # OP_CONST |
4438c4b7 |
610 | no warnings 'void' ; |
0453d815 |
611 | "abc"; # OP_CONST |
612 | 7 ; # OP_CONST |
599cee73 |
613 | EXPECT |
614 | Useless use of a constant in void context at - line 3. |
615 | Useless use of a constant in void context at - line 4. |
616 | ######## |
617 | # op.c |
7f01dc7a |
618 | # |
e476b1b5 |
619 | use warnings 'misc' ; |
599cee73 |
620 | my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ; |
621 | @a =~ /abc/ ; |
622 | @a =~ s/a/b/ ; |
623 | @a =~ tr/a/b/ ; |
624 | @$b =~ /abc/ ; |
625 | @$b =~ s/a/b/ ; |
626 | @$b =~ tr/a/b/ ; |
627 | %a =~ /abc/ ; |
628 | %a =~ s/a/b/ ; |
629 | %a =~ tr/a/b/ ; |
630 | %$c =~ /abc/ ; |
631 | %$c =~ s/a/b/ ; |
632 | %$c =~ tr/a/b/ ; |
0453d815 |
633 | { |
e476b1b5 |
634 | no warnings 'misc' ; |
0453d815 |
635 | my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ; |
636 | @a =~ /abc/ ; |
637 | @a =~ s/a/b/ ; |
638 | @a =~ tr/a/b/ ; |
639 | @$b =~ /abc/ ; |
640 | @$b =~ s/a/b/ ; |
641 | @$b =~ tr/a/b/ ; |
642 | %a =~ /abc/ ; |
643 | %a =~ s/a/b/ ; |
644 | %a =~ tr/a/b/ ; |
645 | %$c =~ /abc/ ; |
646 | %$c =~ s/a/b/ ; |
647 | %$c =~ tr/a/b/ ; |
648 | } |
599cee73 |
649 | EXPECT |
42d38218 |
650 | Applying pattern match (m//) to @array will act on scalar(@array) at - line 5. |
651 | Applying substitution (s///) to @array will act on scalar(@array) at - line 6. |
f1612b5c |
652 | Applying transliteration (tr///) to @array will act on scalar(@array) at - line 7. |
42d38218 |
653 | Applying pattern match (m//) to @array will act on scalar(@array) at - line 8. |
654 | Applying substitution (s///) to @array will act on scalar(@array) at - line 9. |
f1612b5c |
655 | Applying transliteration (tr///) to @array will act on scalar(@array) at - line 10. |
42d38218 |
656 | Applying pattern match (m//) to %hash will act on scalar(%hash) at - line 11. |
657 | Applying substitution (s///) to %hash will act on scalar(%hash) at - line 12. |
f1612b5c |
658 | Applying transliteration (tr///) to %hash will act on scalar(%hash) at - line 13. |
42d38218 |
659 | Applying pattern match (m//) to %hash will act on scalar(%hash) at - line 14. |
660 | Applying substitution (s///) to %hash will act on scalar(%hash) at - line 15. |
f1612b5c |
661 | Applying transliteration (tr///) to %hash will act on scalar(%hash) at - line 16. |
24944567 |
662 | Can't modify private array in substitution (s///) at - line 6, near "s/a/b/ ;" |
f248d071 |
663 | BEGIN not safe after errors--compilation aborted at - line 18. |
599cee73 |
664 | ######## |
665 | # op.c |
4438c4b7 |
666 | use warnings 'syntax' ; |
599cee73 |
667 | my $a, $b = (1,2); |
4438c4b7 |
668 | no warnings 'syntax' ; |
0453d815 |
669 | my $c, $d = (1,2); |
599cee73 |
670 | EXPECT |
df5b6949 |
671 | Parentheses missing around "my" list at - line 3. |
599cee73 |
672 | ######## |
673 | # op.c |
4438c4b7 |
674 | use warnings 'syntax' ; |
599cee73 |
675 | local $a, $b = (1,2); |
4438c4b7 |
676 | no warnings 'syntax' ; |
0453d815 |
677 | local $c, $d = (1,2); |
599cee73 |
678 | EXPECT |
df5b6949 |
679 | Parentheses missing around "local" list at - line 3. |
599cee73 |
680 | ######## |
681 | # op.c |
e476b1b5 |
682 | use warnings 'bareword' ; |
599cee73 |
683 | print (ABC || 1) ; |
e476b1b5 |
684 | no warnings 'bareword' ; |
0453d815 |
685 | print (ABC || 1) ; |
599cee73 |
686 | EXPECT |
34d09196 |
687 | Bareword found in conditional at - line 3. |
599cee73 |
688 | ######## |
689 | --FILE-- abc |
690 | |
691 | --FILE-- |
692 | # op.c |
e476b1b5 |
693 | use warnings 'misc' ; |
599cee73 |
694 | open FH, "<abc" ; |
695 | $x = 1 if $x = <FH> ; |
e476b1b5 |
696 | no warnings 'misc' ; |
0453d815 |
697 | $x = 1 if $x = <FH> ; |
599cee73 |
698 | EXPECT |
699 | Value of <HANDLE> construct can be "0"; test with defined() at - line 4. |
700 | ######## |
701 | # op.c |
e476b1b5 |
702 | use warnings 'misc' ; |
599cee73 |
703 | opendir FH, "." ; |
704 | $x = 1 if $x = readdir FH ; |
e476b1b5 |
705 | no warnings 'misc' ; |
0453d815 |
706 | $x = 1 if $x = readdir FH ; |
599cee73 |
707 | closedir FH ; |
708 | EXPECT |
709 | Value of readdir() operator can be "0"; test with defined() at - line 4. |
710 | ######## |
711 | # op.c |
e476b1b5 |
712 | use warnings 'misc' ; |
599cee73 |
713 | $x = 1 if $x = <*> ; |
e476b1b5 |
714 | no warnings 'misc' ; |
0453d815 |
715 | $x = 1 if $x = <*> ; |
599cee73 |
716 | EXPECT |
717 | Value of glob construct can be "0"; test with defined() at - line 3. |
718 | ######## |
719 | # op.c |
e476b1b5 |
720 | use warnings 'misc' ; |
599cee73 |
721 | %a = (1,2,3,4) ; |
722 | $x = 1 if $x = each %a ; |
e476b1b5 |
723 | no warnings 'misc' ; |
0453d815 |
724 | $x = 1 if $x = each %a ; |
599cee73 |
725 | EXPECT |
726 | Value of each() operator can be "0"; test with defined() at - line 4. |
727 | ######## |
728 | # op.c |
e476b1b5 |
729 | use warnings 'misc' ; |
599cee73 |
730 | $x = 1 while $x = <*> and 0 ; |
e476b1b5 |
731 | no warnings 'misc' ; |
0453d815 |
732 | $x = 1 while $x = <*> and 0 ; |
599cee73 |
733 | EXPECT |
734 | Value of glob construct can be "0"; test with defined() at - line 3. |
735 | ######## |
736 | # op.c |
e476b1b5 |
737 | use warnings 'misc' ; |
599cee73 |
738 | opendir FH, "." ; |
739 | $x = 1 while $x = readdir FH and 0 ; |
e476b1b5 |
740 | no warnings 'misc' ; |
0453d815 |
741 | $x = 1 while $x = readdir FH and 0 ; |
599cee73 |
742 | closedir FH ; |
743 | EXPECT |
744 | Value of readdir() operator can be "0"; test with defined() at - line 4. |
745 | ######## |
746 | # op.c |
4438c4b7 |
747 | use warnings 'redefine' ; |
599cee73 |
748 | sub fred {} |
749 | sub fred {} |
4438c4b7 |
750 | no warnings 'redefine' ; |
0453d815 |
751 | sub fred {} |
599cee73 |
752 | EXPECT |
753 | Subroutine fred redefined at - line 4. |
754 | ######## |
755 | # op.c |
4438c4b7 |
756 | use warnings 'redefine' ; |
599cee73 |
757 | sub fred () { 1 } |
758 | sub fred () { 1 } |
4438c4b7 |
759 | no warnings 'redefine' ; |
0453d815 |
760 | sub fred () { 1 } |
599cee73 |
761 | EXPECT |
762 | Constant subroutine fred redefined at - line 4. |
763 | ######## |
764 | # op.c |
036b4402 |
765 | no warnings 'redefine' ; |
766 | sub fred () { 1 } |
767 | sub fred () { 2 } |
768 | EXPECT |
769 | Constant subroutine fred redefined at - line 4. |
770 | ######## |
771 | # op.c |
772 | no warnings 'redefine' ; |
773 | sub fred () { 1 } |
774 | *fred = sub () { 2 }; |
775 | EXPECT |
776 | Constant subroutine fred redefined at - line 4. |
777 | ######## |
778 | # op.c |
4438c4b7 |
779 | use warnings 'redefine' ; |
599cee73 |
780 | format FRED = |
781 | . |
782 | format FRED = |
783 | . |
4438c4b7 |
784 | no warnings 'redefine' ; |
0453d815 |
785 | format FRED = |
786 | . |
599cee73 |
787 | EXPECT |
788 | Format FRED redefined at - line 5. |
789 | ######## |
790 | # op.c |
e476b1b5 |
791 | use warnings 'deprecated' ; |
599cee73 |
792 | push FRED; |
e476b1b5 |
793 | no warnings 'deprecated' ; |
0453d815 |
794 | push FRED; |
599cee73 |
795 | EXPECT |
796 | Array @FRED missing the @ in argument 1 of push() at - line 3. |
797 | ######## |
798 | # op.c |
e476b1b5 |
799 | use warnings 'deprecated' ; |
599cee73 |
800 | @a = keys FRED ; |
e476b1b5 |
801 | no warnings 'deprecated' ; |
0453d815 |
802 | @a = keys FRED ; |
599cee73 |
803 | EXPECT |
804 | Hash %FRED missing the % in argument 1 of keys() at - line 3. |
805 | ######## |
806 | # op.c |
4438c4b7 |
807 | use warnings 'syntax' ; |
dfe13c55 |
808 | exec "$^X -e 1" ; |
599cee73 |
809 | my $a |
810 | EXPECT |
811 | Statement unlikely to be reached at - line 4. |
cc507455 |
812 | (Maybe you meant system() when you said exec()?) |
69794302 |
813 | ######## |
814 | # op.c |
4438c4b7 |
815 | use warnings 'deprecated' ; |
69794302 |
816 | my @a; defined(@a); |
817 | EXPECT |
f10b0346 |
818 | defined(@array) is deprecated at - line 3. |
cc507455 |
819 | (Maybe you should just omit the defined()?) |
69794302 |
820 | ######## |
821 | # op.c |
4438c4b7 |
822 | use warnings 'deprecated' ; |
69794302 |
823 | defined(@a = (1,2,3)); |
824 | EXPECT |
f10b0346 |
825 | defined(@array) is deprecated at - line 3. |
cc507455 |
826 | (Maybe you should just omit the defined()?) |
69794302 |
827 | ######## |
828 | # op.c |
4438c4b7 |
829 | use warnings 'deprecated' ; |
69794302 |
830 | my %h; defined(%h); |
831 | EXPECT |
f10b0346 |
832 | defined(%hash) is deprecated at - line 3. |
cc507455 |
833 | (Maybe you should just omit the defined()?) |
0453d815 |
834 | ######## |
835 | # op.c |
4438c4b7 |
836 | no warnings 'syntax' ; |
0453d815 |
837 | exec "$^X -e 1" ; |
838 | my $a |
839 | EXPECT |
840 | |
841 | ######## |
842 | # op.c |
843 | sub fred(); |
844 | sub fred($) {} |
845 | EXPECT |
846 | Prototype mismatch: sub main::fred () vs ($) at - line 3. |
847 | ######## |
848 | # op.c |
849 | $^W = 0 ; |
850 | sub fred() ; |
851 | sub fred($) {} |
852 | { |
e476b1b5 |
853 | no warnings 'prototype' ; |
0453d815 |
854 | sub Fred() ; |
855 | sub Fred($) {} |
e476b1b5 |
856 | use warnings 'prototype' ; |
0453d815 |
857 | sub freD() ; |
858 | sub freD($) {} |
859 | } |
860 | sub FRED() ; |
861 | sub FRED($) {} |
862 | EXPECT |
863 | Prototype mismatch: sub main::fred () vs ($) at - line 4. |
864 | Prototype mismatch: sub main::freD () vs ($) at - line 11. |
865 | Prototype mismatch: sub main::FRED () vs ($) at - line 14. |
eb6e2d6f |
866 | ######## |
867 | # op.c |
868 | use warnings 'syntax' ; |
869 | join /---/, 'x', 'y', 'z'; |
870 | EXPECT |
871 | /---/ should probably be written as "---" at - line 3. |
767a6a26 |
872 | ######## |
873 | # op.c [Perl_peep] |
e476b1b5 |
874 | use warnings 'prototype' ; |
767a6a26 |
875 | fred() ; |
876 | sub fred ($$) {} |
e476b1b5 |
877 | no warnings 'prototype' ; |
767a6a26 |
878 | joe() ; |
879 | sub joe ($$) {} |
880 | EXPECT |
881 | main::fred() called too early to check prototype at - line 3. |
ddda08b7 |
882 | ######## |
883 | # op.c [Perl_newATTRSUB] |
884 | --FILE-- abc.pm |
885 | use warnings 'void' ; |
886 | BEGIN { $| = 1; print "in begin\n"; } |
887 | CHECK { print "in check\n"; } |
888 | INIT { print "in init\n"; } |
889 | END { print "in end\n"; } |
890 | print "in mainline\n"; |
891 | 1; |
892 | --FILE-- |
893 | use abc; |
894 | delete $INC{"abc.pm"}; |
895 | require abc; |
896 | do "abc.pm"; |
897 | EXPECT |
898 | in begin |
899 | in mainline |
900 | in check |
901 | in init |
902 | in begin |
903 | Too late to run CHECK block at abc.pm line 3. |
904 | Too late to run INIT block at abc.pm line 4. |
905 | in mainline |
906 | in begin |
907 | Too late to run CHECK block at abc.pm line 3. |
908 | Too late to run INIT block at abc.pm line 4. |
909 | in mainline |
910 | in end |
911 | in end |
912 | in end |
913 | ######## |
914 | # op.c [Perl_newATTRSUB] |
915 | --FILE-- abc.pm |
916 | no warnings 'void' ; |
917 | BEGIN { $| = 1; print "in begin\n"; } |
918 | CHECK { print "in check\n"; } |
919 | INIT { print "in init\n"; } |
920 | END { print "in end\n"; } |
921 | print "in mainline\n"; |
922 | 1; |
923 | --FILE-- |
924 | require abc; |
925 | do "abc.pm"; |
926 | EXPECT |
927 | in begin |
928 | in mainline |
929 | in begin |
930 | in mainline |
931 | in end |
932 | in end |
936edb8b |
933 | ######## |
934 | # op.c |
935 | my @x; |
f87c3213 |
936 | use warnings 'syntax' ; |
936edb8b |
937 | push(@x); |
938 | unshift(@x); |
f87c3213 |
939 | no warnings 'syntax' ; |
936edb8b |
940 | push(@x); |
941 | unshift(@x); |
942 | EXPECT |
de4864e4 |
943 | Useless use of push with no values at - line 4. |
944 | Useless use of unshift with no values at - line 5. |
a27978d3 |
945 | ######## |
946 | # op.c |
f2c0fa37 |
947 | use warnings 'deprecated' ; |
948 | package; |
949 | no warnings 'deprecated' ; |
950 | package; |
951 | EXPECT |
952 | Use of "package" with no arguments is deprecated at - line 3. |
41f494d5 |
953 | Global symbol "BEGIN" requires explicit package name at - line 4. |
954 | BEGIN not safe after errors--compilation aborted at - line 4. |
3b434eb1 |
955 | ######## |
956 | # op.c [Perl_utilize] |
957 | use warnings 'misc'; |
958 | push @INC, sub { $_[1] eq 'Joe.pm' ? *DATA : undef }; |
959 | eval "use Joe"; |
960 | __DATA__ |
961 | package joe; 1; |
962 | EXPECT |
963 | Package `Joe' not found (did you use the incorrect case?) at (eval 1) line 2. |