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