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