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