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