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