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 | |
39 | Applying %s to %s will act on scalar(%s) |
40 | my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ; |
41 | @a =~ /abc/ ; |
42 | @a =~ s/a/b/ ; |
43 | @a =~ tr/a/b/ ; |
44 | @$b =~ /abc/ ; |
45 | @$b =~ s/a/b/ ; |
46 | @$b =~ tr/a/b/ ; |
47 | %a =~ /abc/ ; |
48 | %a =~ s/a/b/ ; |
49 | %a =~ tr/a/b/ ; |
50 | %$c =~ /abc/ ; |
51 | %$c =~ s/a/b/ ; |
52 | %$c =~ tr/a/b/ ; |
53 | |
54 | |
df5b6949 |
55 | Parentheses missing around "my" list at -e line 1. |
599cee73 |
56 | my $a, $b = (1,2); |
57 | |
df5b6949 |
58 | Parentheses missing around "local" list at -e line 1. |
599cee73 |
59 | local $a, $b = (1,2); |
60 | |
34d09196 |
61 | Bareword found in conditional at -e line 1. |
e476b1b5 |
62 | use warnings 'bareword'; my $x = print(ABC || 1); |
599cee73 |
63 | |
64 | Value of %s may be \"0\"; use \"defined\" |
65 | $x = 1 if $x = <FH> ; |
66 | $x = 1 while $x = <FH> ; |
67 | |
68 | Subroutine fred redefined at -e line 1. |
69 | sub fred{1;} sub fred{1;} |
70 | |
71 | Constant subroutine %s redefined |
72 | sub fred() {1;} sub fred() {1;} |
73 | |
74 | Format FRED redefined at /tmp/x line 5. |
75 | format FRED = |
76 | . |
77 | format FRED = |
78 | . |
79 | |
80 | Array @%s missing the @ in argument %d of %s() |
81 | push fred ; |
82 | |
83 | Hash %%%s missing the %% in argument %d of %s() |
84 | keys joe ; |
85 | |
86 | Statement unlikely to be reached |
cc507455 |
87 | (Maybe you meant system() when you said exec()? |
599cee73 |
88 | exec "true" ; my $a |
89 | |
f10b0346 |
90 | defined(@array) is deprecated |
cc507455 |
91 | (Maybe you should just omit the defined()?) |
69794302 |
92 | my @a ; defined @a ; |
93 | defined (@a = (1,2,3)) ; |
94 | |
f10b0346 |
95 | defined(%hash) is deprecated |
cc507455 |
96 | (Maybe you should just omit the defined()?) |
69794302 |
97 | my %h ; defined %h ; |
eb6e2d6f |
98 | |
99 | /---/ should probably be written as "---" |
100 | join(/---/, @foo); |
599cee73 |
101 | |
767a6a26 |
102 | %s() called too early to check prototype [Perl_peep] |
103 | fred() ; sub fred ($$) {} |
104 | |
a27978d3 |
105 | Non-octal literal mode (%d) specified |
106 | (Did you mean 0%d instead?) |
107 | chmod 777, "foo"; |
108 | mkdir "foo", 777; |
109 | umask 222; |
767a6a26 |
110 | |
f2c0fa37 |
111 | Use of "package" with no arguments is deprecated |
112 | package; |
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 |
4438c4b7 |
338 | no warnings 'void' ; close STDIN ; |
0453d815 |
339 | 1 x 3 ; # OP_REPEAT |
340 | # OP_GVSV |
341 | wantarray ; # OP_WANTARRAY |
342 | # OP_GV |
343 | # OP_PADSV |
344 | # OP_PADAV |
345 | # OP_PADHV |
346 | # OP_PADANY |
347 | # OP_AV2ARYLEN |
348 | ref ; # OP_REF |
349 | \@a ; # OP_REFGEN |
350 | \$a ; # OP_SREFGEN |
351 | defined $a ; # OP_DEFINED |
352 | hex $a ; # OP_HEX |
353 | oct $a ; # OP_OCT |
354 | length $a ; # OP_LENGTH |
355 | substr $a,1 ; # OP_SUBSTR |
356 | vec $a,1,2 ; # OP_VEC |
357 | index $a,1,2 ; # OP_INDEX |
358 | rindex $a,1,2 ; # OP_RINDEX |
359 | sprintf $a ; # OP_SPRINTF |
360 | $a[0] ; # OP_AELEM |
361 | # OP_AELEMFAST |
362 | @a[0] ; # OP_ASLICE |
363 | #values %a ; # OP_VALUES |
364 | #keys %a ; # OP_KEYS |
365 | $a{0} ; # OP_HELEM |
366 | @a{0} ; # OP_HSLICE |
367 | unpack "a", "a" ; # OP_UNPACK |
368 | pack $a,"" ; # OP_PACK |
369 | join "" ; # OP_JOIN |
370 | (@a)[0,1] ; # OP_LSLICE |
371 | # OP_ANONLIST |
372 | # OP_ANONHASH |
373 | sort(1,2) ; # OP_SORT |
374 | reverse(1,2) ; # OP_REVERSE |
375 | # OP_RANGE |
376 | # OP_FLIP |
377 | (1 ..2) ; # OP_FLOP |
378 | caller ; # OP_CALLER |
379 | fileno STDIN ; # OP_FILENO |
380 | eof STDIN ; # OP_EOF |
381 | tell STDIN ; # OP_TELL |
382 | readlink 1; # OP_READLINK |
383 | time ; # OP_TIME |
384 | localtime ; # OP_LOCALTIME |
385 | gmtime ; # OP_GMTIME |
386 | eval { getgrnam 1 }; # OP_GGRNAM |
387 | eval { getgrgid 1 }; # OP_GGRGID |
388 | eval { getpwnam 1 }; # OP_GPWNAM |
389 | eval { getpwuid 1 }; # OP_GPWUID |
390 | EXPECT |
391 | ######## |
392 | # op.c |
4438c4b7 |
393 | use warnings 'void' ; |
68c73484 |
394 | for (@{[0]}) { "$_" } # check warning isn't duplicated |
4438c4b7 |
395 | no warnings 'void' ; |
0453d815 |
396 | for (@{[0]}) { "$_" } # check warning isn't duplicated |
68c73484 |
397 | EXPECT |
398 | Useless use of string in void context at - line 3. |
399 | ######## |
400 | # op.c |
4438c4b7 |
401 | use warnings 'void' ; |
599cee73 |
402 | use Config ; |
403 | BEGIN { |
404 | if ( ! $Config{d_telldir}) { |
405 | print <<EOM ; |
406 | SKIPPED |
407 | # telldir not present |
408 | EOM |
409 | exit |
410 | } |
411 | } |
412 | telldir 1 ; # OP_TELLDIR |
4438c4b7 |
413 | no warnings 'void' ; |
0453d815 |
414 | telldir 1 ; # OP_TELLDIR |
599cee73 |
415 | EXPECT |
416 | Useless use of telldir in void context at - line 13. |
417 | ######## |
418 | # op.c |
4438c4b7 |
419 | use warnings 'void' ; |
599cee73 |
420 | use Config ; |
421 | BEGIN { |
422 | if ( ! $Config{d_getppid}) { |
423 | print <<EOM ; |
424 | SKIPPED |
425 | # getppid not present |
426 | EOM |
427 | exit |
428 | } |
429 | } |
430 | getppid ; # OP_GETPPID |
4438c4b7 |
431 | no warnings 'void' ; |
0453d815 |
432 | getppid ; # OP_GETPPID |
599cee73 |
433 | EXPECT |
434 | Useless use of getppid in void context at - line 13. |
435 | ######## |
436 | # op.c |
4438c4b7 |
437 | use warnings 'void' ; |
599cee73 |
438 | use Config ; |
439 | BEGIN { |
440 | if ( ! $Config{d_getpgrp}) { |
441 | print <<EOM ; |
442 | SKIPPED |
443 | # getpgrp not present |
444 | EOM |
445 | exit |
446 | } |
447 | } |
448 | getpgrp ; # OP_GETPGRP |
4438c4b7 |
449 | no warnings 'void' ; |
0453d815 |
450 | getpgrp ; # OP_GETPGRP |
599cee73 |
451 | EXPECT |
452 | Useless use of getpgrp in void context at - line 13. |
453 | ######## |
454 | # op.c |
4438c4b7 |
455 | use warnings 'void' ; |
599cee73 |
456 | use Config ; |
457 | BEGIN { |
458 | if ( ! $Config{d_times}) { |
459 | print <<EOM ; |
460 | SKIPPED |
461 | # times not present |
462 | EOM |
463 | exit |
464 | } |
465 | } |
466 | times ; # OP_TMS |
4438c4b7 |
467 | no warnings 'void' ; |
0453d815 |
468 | times ; # OP_TMS |
599cee73 |
469 | EXPECT |
470 | Useless use of times in void context at - line 13. |
471 | ######## |
472 | # op.c |
4438c4b7 |
473 | use warnings 'void' ; |
599cee73 |
474 | use Config ; |
475 | BEGIN { |
e96326af |
476 | if ( ! $Config{d_getprior} or $^O eq 'os2') { # Locks before fixpak22 |
599cee73 |
477 | print <<EOM ; |
478 | SKIPPED |
479 | # getpriority not present |
480 | EOM |
481 | exit |
482 | } |
483 | } |
484 | getpriority 1,2; # OP_GETPRIORITY |
4438c4b7 |
485 | no warnings 'void' ; |
0453d815 |
486 | getpriority 1,2; # OP_GETPRIORITY |
599cee73 |
487 | EXPECT |
488 | Useless use of getpriority in void context at - line 13. |
489 | ######## |
490 | # op.c |
4438c4b7 |
491 | use warnings 'void' ; |
599cee73 |
492 | use Config ; |
493 | BEGIN { |
494 | if ( ! $Config{d_getlogin}) { |
495 | print <<EOM ; |
496 | SKIPPED |
497 | # getlogin not present |
498 | EOM |
499 | exit |
500 | } |
501 | } |
502 | getlogin ; # OP_GETLOGIN |
4438c4b7 |
503 | no warnings 'void' ; |
0453d815 |
504 | getlogin ; # OP_GETLOGIN |
599cee73 |
505 | EXPECT |
506 | Useless use of getlogin in void context at - line 13. |
507 | ######## |
508 | # op.c |
4438c4b7 |
509 | use warnings 'void' ; |
599cee73 |
510 | use Config ; BEGIN { |
511 | if ( ! $Config{d_socket}) { |
512 | print <<EOM ; |
513 | SKIPPED |
514 | # getsockname not present |
515 | # getpeername not present |
516 | # gethostbyname not present |
517 | # gethostbyaddr not present |
518 | # gethostent not present |
519 | # getnetbyname not present |
520 | # getnetbyaddr not present |
521 | # getnetent not present |
522 | # getprotobyname not present |
523 | # getprotobynumber not present |
524 | # getprotoent not present |
525 | # getservbyname not present |
526 | # getservbyport not present |
527 | # getservent not present |
528 | EOM |
529 | exit |
530 | } } |
531 | getsockname STDIN ; # OP_GETSOCKNAME |
532 | getpeername STDIN ; # OP_GETPEERNAME |
533 | gethostbyname 1 ; # OP_GHBYNAME |
534 | gethostbyaddr 1,2; # OP_GHBYADDR |
535 | gethostent ; # OP_GHOSTENT |
536 | getnetbyname 1 ; # OP_GNBYNAME |
537 | getnetbyaddr 1,2 ; # OP_GNBYADDR |
538 | getnetent ; # OP_GNETENT |
539 | getprotobyname 1; # OP_GPBYNAME |
540 | getprotobynumber 1; # OP_GPBYNUMBER |
541 | getprotoent ; # OP_GPROTOENT |
542 | getservbyname 1,2; # OP_GSBYNAME |
543 | getservbyport 1,2; # OP_GSBYPORT |
544 | getservent ; # OP_GSERVENT |
0453d815 |
545 | |
4438c4b7 |
546 | no warnings 'void' ; |
0453d815 |
547 | getsockname STDIN ; # OP_GETSOCKNAME |
548 | getpeername STDIN ; # OP_GETPEERNAME |
549 | gethostbyname 1 ; # OP_GHBYNAME |
550 | gethostbyaddr 1,2; # OP_GHBYADDR |
551 | gethostent ; # OP_GHOSTENT |
552 | getnetbyname 1 ; # OP_GNBYNAME |
553 | getnetbyaddr 1,2 ; # OP_GNBYADDR |
554 | getnetent ; # OP_GNETENT |
555 | getprotobyname 1; # OP_GPBYNAME |
556 | getprotobynumber 1; # OP_GPBYNUMBER |
557 | getprotoent ; # OP_GPROTOENT |
558 | getservbyname 1,2; # OP_GSBYNAME |
559 | getservbyport 1,2; # OP_GSBYPORT |
560 | getservent ; # OP_GSERVENT |
dfe13c55 |
561 | INIT { |
562 | # some functions may not be there, so we exit without running |
563 | exit; |
564 | } |
599cee73 |
565 | EXPECT |
566 | Useless use of getsockname in void context at - line 24. |
567 | Useless use of getpeername in void context at - line 25. |
568 | Useless use of gethostbyname in void context at - line 26. |
569 | Useless use of gethostbyaddr in void context at - line 27. |
570 | Useless use of gethostent in void context at - line 28. |
571 | Useless use of getnetbyname in void context at - line 29. |
572 | Useless use of getnetbyaddr in void context at - line 30. |
573 | Useless use of getnetent in void context at - line 31. |
574 | Useless use of getprotobyname in void context at - line 32. |
575 | Useless use of getprotobynumber in void context at - line 33. |
576 | Useless use of getprotoent in void context at - line 34. |
577 | Useless use of getservbyname in void context at - line 35. |
578 | Useless use of getservbyport in void context at - line 36. |
579 | Useless use of getservent in void context at - line 37. |
580 | ######## |
581 | # op.c |
4438c4b7 |
582 | use warnings 'void' ; |
599cee73 |
583 | *a ; # OP_RV2GV |
584 | $a ; # OP_RV2SV |
585 | @a ; # OP_RV2AV |
586 | %a ; # OP_RV2HV |
4438c4b7 |
587 | no warnings 'void' ; |
0453d815 |
588 | *a ; # OP_RV2GV |
589 | $a ; # OP_RV2SV |
590 | @a ; # OP_RV2AV |
591 | %a ; # OP_RV2HV |
599cee73 |
592 | EXPECT |
593 | Useless use of a variable in void context at - line 3. |
594 | Useless use of a variable in void context at - line 4. |
595 | Useless use of a variable in void context at - line 5. |
596 | Useless use of a variable in void context at - line 6. |
597 | ######## |
598 | # op.c |
4438c4b7 |
599 | use warnings 'void' ; |
599cee73 |
600 | "abc"; # OP_CONST |
601 | 7 ; # OP_CONST |
4438c4b7 |
602 | no warnings 'void' ; |
0453d815 |
603 | "abc"; # OP_CONST |
604 | 7 ; # OP_CONST |
599cee73 |
605 | EXPECT |
606 | Useless use of a constant in void context at - line 3. |
607 | Useless use of a constant in void context at - line 4. |
608 | ######## |
609 | # op.c |
7f01dc7a |
610 | # |
e476b1b5 |
611 | use warnings 'misc' ; |
599cee73 |
612 | my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ; |
613 | @a =~ /abc/ ; |
614 | @a =~ s/a/b/ ; |
615 | @a =~ tr/a/b/ ; |
616 | @$b =~ /abc/ ; |
617 | @$b =~ s/a/b/ ; |
618 | @$b =~ tr/a/b/ ; |
619 | %a =~ /abc/ ; |
620 | %a =~ s/a/b/ ; |
621 | %a =~ tr/a/b/ ; |
622 | %$c =~ /abc/ ; |
623 | %$c =~ s/a/b/ ; |
624 | %$c =~ tr/a/b/ ; |
0453d815 |
625 | { |
e476b1b5 |
626 | no warnings 'misc' ; |
0453d815 |
627 | my $a ; my @a = () ; my %a = () ; my $b = \@a ; my $c = \%a ; |
628 | @a =~ /abc/ ; |
629 | @a =~ s/a/b/ ; |
630 | @a =~ tr/a/b/ ; |
631 | @$b =~ /abc/ ; |
632 | @$b =~ s/a/b/ ; |
633 | @$b =~ tr/a/b/ ; |
634 | %a =~ /abc/ ; |
635 | %a =~ s/a/b/ ; |
636 | %a =~ tr/a/b/ ; |
637 | %$c =~ /abc/ ; |
638 | %$c =~ s/a/b/ ; |
639 | %$c =~ tr/a/b/ ; |
640 | } |
599cee73 |
641 | EXPECT |
42d38218 |
642 | Applying pattern match (m//) to @array will act on scalar(@array) at - line 5. |
643 | Applying substitution (s///) to @array will act on scalar(@array) at - line 6. |
f1612b5c |
644 | Applying transliteration (tr///) to @array will act on scalar(@array) at - line 7. |
42d38218 |
645 | Applying pattern match (m//) to @array will act on scalar(@array) at - line 8. |
646 | Applying substitution (s///) to @array will act on scalar(@array) at - line 9. |
f1612b5c |
647 | Applying transliteration (tr///) to @array will act on scalar(@array) at - line 10. |
42d38218 |
648 | Applying pattern match (m//) to %hash will act on scalar(%hash) at - line 11. |
649 | Applying substitution (s///) to %hash will act on scalar(%hash) at - line 12. |
f1612b5c |
650 | Applying transliteration (tr///) to %hash will act on scalar(%hash) at - line 13. |
42d38218 |
651 | Applying pattern match (m//) to %hash will act on scalar(%hash) at - line 14. |
652 | Applying substitution (s///) to %hash will act on scalar(%hash) at - line 15. |
f1612b5c |
653 | Applying transliteration (tr///) to %hash will act on scalar(%hash) at - line 16. |
24944567 |
654 | Can't modify private array in substitution (s///) at - line 6, near "s/a/b/ ;" |
f248d071 |
655 | BEGIN not safe after errors--compilation aborted at - line 18. |
599cee73 |
656 | ######## |
657 | # op.c |
4438c4b7 |
658 | use warnings 'syntax' ; |
599cee73 |
659 | my $a, $b = (1,2); |
4438c4b7 |
660 | no warnings 'syntax' ; |
0453d815 |
661 | my $c, $d = (1,2); |
599cee73 |
662 | EXPECT |
df5b6949 |
663 | Parentheses missing around "my" list at - line 3. |
599cee73 |
664 | ######## |
665 | # op.c |
4438c4b7 |
666 | use warnings 'syntax' ; |
599cee73 |
667 | local $a, $b = (1,2); |
4438c4b7 |
668 | no warnings 'syntax' ; |
0453d815 |
669 | local $c, $d = (1,2); |
599cee73 |
670 | EXPECT |
df5b6949 |
671 | Parentheses missing around "local" list at - line 3. |
599cee73 |
672 | ######## |
673 | # op.c |
e476b1b5 |
674 | use warnings 'bareword' ; |
599cee73 |
675 | print (ABC || 1) ; |
e476b1b5 |
676 | no warnings 'bareword' ; |
0453d815 |
677 | print (ABC || 1) ; |
599cee73 |
678 | EXPECT |
34d09196 |
679 | Bareword found in conditional at - line 3. |
599cee73 |
680 | ######## |
681 | --FILE-- abc |
682 | |
683 | --FILE-- |
684 | # op.c |
e476b1b5 |
685 | use warnings 'misc' ; |
599cee73 |
686 | open FH, "<abc" ; |
687 | $x = 1 if $x = <FH> ; |
e476b1b5 |
688 | no warnings 'misc' ; |
0453d815 |
689 | $x = 1 if $x = <FH> ; |
599cee73 |
690 | EXPECT |
691 | Value of <HANDLE> construct can be "0"; test with defined() at - line 4. |
692 | ######## |
693 | # op.c |
e476b1b5 |
694 | use warnings 'misc' ; |
599cee73 |
695 | opendir FH, "." ; |
696 | $x = 1 if $x = readdir FH ; |
e476b1b5 |
697 | no warnings 'misc' ; |
0453d815 |
698 | $x = 1 if $x = readdir FH ; |
599cee73 |
699 | closedir FH ; |
700 | EXPECT |
701 | Value of readdir() operator can be "0"; test with defined() at - line 4. |
702 | ######## |
703 | # op.c |
e476b1b5 |
704 | use warnings 'misc' ; |
599cee73 |
705 | $x = 1 if $x = <*> ; |
e476b1b5 |
706 | no warnings 'misc' ; |
0453d815 |
707 | $x = 1 if $x = <*> ; |
599cee73 |
708 | EXPECT |
709 | Value of glob construct can be "0"; test with defined() at - line 3. |
710 | ######## |
711 | # op.c |
e476b1b5 |
712 | use warnings 'misc' ; |
599cee73 |
713 | %a = (1,2,3,4) ; |
714 | $x = 1 if $x = each %a ; |
e476b1b5 |
715 | no warnings 'misc' ; |
0453d815 |
716 | $x = 1 if $x = each %a ; |
599cee73 |
717 | EXPECT |
718 | Value of each() operator can be "0"; test with defined() at - line 4. |
719 | ######## |
720 | # op.c |
e476b1b5 |
721 | use warnings 'misc' ; |
599cee73 |
722 | $x = 1 while $x = <*> and 0 ; |
e476b1b5 |
723 | no warnings 'misc' ; |
0453d815 |
724 | $x = 1 while $x = <*> and 0 ; |
599cee73 |
725 | EXPECT |
726 | Value of glob construct can be "0"; test with defined() at - line 3. |
727 | ######## |
728 | # op.c |
e476b1b5 |
729 | use warnings 'misc' ; |
599cee73 |
730 | opendir FH, "." ; |
731 | $x = 1 while $x = readdir FH and 0 ; |
e476b1b5 |
732 | no warnings 'misc' ; |
0453d815 |
733 | $x = 1 while $x = readdir FH and 0 ; |
599cee73 |
734 | closedir FH ; |
735 | EXPECT |
736 | Value of readdir() operator can be "0"; test with defined() at - line 4. |
737 | ######## |
738 | # op.c |
4438c4b7 |
739 | use warnings 'redefine' ; |
599cee73 |
740 | sub fred {} |
741 | sub fred {} |
4438c4b7 |
742 | no warnings 'redefine' ; |
0453d815 |
743 | sub fred {} |
599cee73 |
744 | EXPECT |
745 | Subroutine fred redefined at - line 4. |
746 | ######## |
747 | # op.c |
4438c4b7 |
748 | use warnings 'redefine' ; |
599cee73 |
749 | sub fred () { 1 } |
750 | sub fred () { 1 } |
4438c4b7 |
751 | no warnings 'redefine' ; |
0453d815 |
752 | sub fred () { 1 } |
599cee73 |
753 | EXPECT |
754 | Constant subroutine fred redefined at - line 4. |
755 | ######## |
756 | # op.c |
036b4402 |
757 | no warnings 'redefine' ; |
758 | sub fred () { 1 } |
759 | sub fred () { 2 } |
760 | EXPECT |
761 | Constant subroutine fred redefined at - line 4. |
762 | ######## |
763 | # op.c |
764 | no warnings 'redefine' ; |
765 | sub fred () { 1 } |
766 | *fred = sub () { 2 }; |
767 | EXPECT |
768 | Constant subroutine fred redefined at - line 4. |
769 | ######## |
770 | # op.c |
4438c4b7 |
771 | use warnings 'redefine' ; |
599cee73 |
772 | format FRED = |
773 | . |
774 | format FRED = |
775 | . |
4438c4b7 |
776 | no warnings 'redefine' ; |
0453d815 |
777 | format FRED = |
778 | . |
599cee73 |
779 | EXPECT |
780 | Format FRED redefined at - line 5. |
781 | ######## |
782 | # op.c |
e476b1b5 |
783 | use warnings 'deprecated' ; |
599cee73 |
784 | push FRED; |
e476b1b5 |
785 | no warnings 'deprecated' ; |
0453d815 |
786 | push FRED; |
599cee73 |
787 | EXPECT |
788 | Array @FRED missing the @ in argument 1 of push() at - line 3. |
789 | ######## |
790 | # op.c |
e476b1b5 |
791 | use warnings 'deprecated' ; |
599cee73 |
792 | @a = keys FRED ; |
e476b1b5 |
793 | no warnings 'deprecated' ; |
0453d815 |
794 | @a = keys FRED ; |
599cee73 |
795 | EXPECT |
796 | Hash %FRED missing the % in argument 1 of keys() at - line 3. |
797 | ######## |
798 | # op.c |
4438c4b7 |
799 | use warnings 'syntax' ; |
dfe13c55 |
800 | exec "$^X -e 1" ; |
599cee73 |
801 | my $a |
802 | EXPECT |
803 | Statement unlikely to be reached at - line 4. |
cc507455 |
804 | (Maybe you meant system() when you said exec()?) |
69794302 |
805 | ######## |
806 | # op.c |
4438c4b7 |
807 | use warnings 'deprecated' ; |
69794302 |
808 | my @a; defined(@a); |
809 | EXPECT |
f10b0346 |
810 | defined(@array) is deprecated at - line 3. |
cc507455 |
811 | (Maybe you should just omit the defined()?) |
69794302 |
812 | ######## |
813 | # op.c |
4438c4b7 |
814 | use warnings 'deprecated' ; |
69794302 |
815 | defined(@a = (1,2,3)); |
816 | EXPECT |
f10b0346 |
817 | defined(@array) is deprecated at - line 3. |
cc507455 |
818 | (Maybe you should just omit the defined()?) |
69794302 |
819 | ######## |
820 | # op.c |
4438c4b7 |
821 | use warnings 'deprecated' ; |
69794302 |
822 | my %h; defined(%h); |
823 | EXPECT |
f10b0346 |
824 | defined(%hash) is deprecated at - line 3. |
cc507455 |
825 | (Maybe you should just omit the defined()?) |
0453d815 |
826 | ######## |
827 | # op.c |
4438c4b7 |
828 | no warnings 'syntax' ; |
0453d815 |
829 | exec "$^X -e 1" ; |
830 | my $a |
831 | EXPECT |
832 | |
833 | ######## |
834 | # op.c |
835 | sub fred(); |
836 | sub fred($) {} |
837 | EXPECT |
838 | Prototype mismatch: sub main::fred () vs ($) at - line 3. |
839 | ######## |
840 | # op.c |
841 | $^W = 0 ; |
842 | sub fred() ; |
843 | sub fred($) {} |
844 | { |
e476b1b5 |
845 | no warnings 'prototype' ; |
0453d815 |
846 | sub Fred() ; |
847 | sub Fred($) {} |
e476b1b5 |
848 | use warnings 'prototype' ; |
0453d815 |
849 | sub freD() ; |
850 | sub freD($) {} |
851 | } |
852 | sub FRED() ; |
853 | sub FRED($) {} |
854 | EXPECT |
855 | Prototype mismatch: sub main::fred () vs ($) at - line 4. |
856 | Prototype mismatch: sub main::freD () vs ($) at - line 11. |
857 | Prototype mismatch: sub main::FRED () vs ($) at - line 14. |
eb6e2d6f |
858 | ######## |
859 | # op.c |
860 | use warnings 'syntax' ; |
861 | join /---/, 'x', 'y', 'z'; |
862 | EXPECT |
863 | /---/ should probably be written as "---" at - line 3. |
767a6a26 |
864 | ######## |
865 | # op.c [Perl_peep] |
e476b1b5 |
866 | use warnings 'prototype' ; |
767a6a26 |
867 | fred() ; |
868 | sub fred ($$) {} |
e476b1b5 |
869 | no warnings 'prototype' ; |
767a6a26 |
870 | joe() ; |
871 | sub joe ($$) {} |
872 | EXPECT |
873 | main::fred() called too early to check prototype at - line 3. |
ddda08b7 |
874 | ######## |
875 | # op.c [Perl_newATTRSUB] |
876 | --FILE-- abc.pm |
877 | use warnings 'void' ; |
878 | BEGIN { $| = 1; print "in begin\n"; } |
879 | CHECK { print "in check\n"; } |
880 | INIT { print "in init\n"; } |
881 | END { print "in end\n"; } |
882 | print "in mainline\n"; |
883 | 1; |
884 | --FILE-- |
885 | use abc; |
886 | delete $INC{"abc.pm"}; |
887 | require abc; |
888 | do "abc.pm"; |
889 | EXPECT |
890 | in begin |
891 | in mainline |
892 | in check |
893 | in init |
894 | in begin |
895 | Too late to run CHECK block at abc.pm line 3. |
896 | Too late to run INIT block at abc.pm line 4. |
897 | in mainline |
898 | in begin |
899 | Too late to run CHECK block at abc.pm line 3. |
900 | Too late to run INIT block at abc.pm line 4. |
901 | in mainline |
902 | in end |
903 | in end |
904 | in end |
905 | ######## |
906 | # op.c [Perl_newATTRSUB] |
907 | --FILE-- abc.pm |
908 | no warnings 'void' ; |
909 | BEGIN { $| = 1; print "in begin\n"; } |
910 | CHECK { print "in check\n"; } |
911 | INIT { print "in init\n"; } |
912 | END { print "in end\n"; } |
913 | print "in mainline\n"; |
914 | 1; |
915 | --FILE-- |
916 | require abc; |
917 | do "abc.pm"; |
918 | EXPECT |
919 | in begin |
920 | in mainline |
921 | in begin |
922 | in mainline |
923 | in end |
924 | in end |
936edb8b |
925 | ######## |
926 | # op.c |
927 | my @x; |
f87c3213 |
928 | use warnings 'syntax' ; |
936edb8b |
929 | push(@x); |
930 | unshift(@x); |
f87c3213 |
931 | no warnings 'syntax' ; |
936edb8b |
932 | push(@x); |
933 | unshift(@x); |
934 | EXPECT |
de4864e4 |
935 | Useless use of push with no values at - line 4. |
936 | Useless use of unshift with no values at - line 5. |
a27978d3 |
937 | ######## |
938 | # op.c |
939 | use warnings 'chmod' ; |
940 | chmod 777; |
941 | no warnings 'chmod' ; |
942 | chmod 777; |
943 | EXPECT |
944 | Non-octal literal mode (777) specified at - line 3. |
945 | (Did you mean 0777 instead?) |
946 | ######## |
947 | # op.c |
948 | use warnings 'umask' ; |
949 | umask 222; |
950 | no warnings 'umask' ; |
951 | umask 222; |
952 | EXPECT |
953 | Non-octal literal mode (222) specified at - line 3. |
954 | (Did you mean 0222 instead?) |
955 | ######## |
956 | # op.c |
957 | use warnings 'mkdir' ; |
958 | mkdir "", 777; |
959 | no warnings 'mkdir' ; |
960 | mkdir "", 777; |
961 | EXPECT |
962 | Non-octal literal mode (777) specified at - line 3. |
963 | (Did you mean 0777 instead?) |
f2c0fa37 |
964 | ######## |
965 | # op.c |
966 | use warnings 'deprecated' ; |
967 | package; |
968 | no warnings 'deprecated' ; |
969 | package; |
970 | EXPECT |
971 | Use of "package" with no arguments is deprecated at - line 3. |