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