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