113 lines
2.1 KiB
Plaintext
113 lines
2.1 KiB
Plaintext
|
Check lint
|
||
|
|
||
|
__END__
|
||
|
-W
|
||
|
# lint: check compile time $^W is zapped
|
||
|
BEGIN { $^W = 0 ;}
|
||
|
$a = $b = 1 ;
|
||
|
$a = 1 if $a EQ $b ;
|
||
|
close STDIN ; print STDIN "abc" ;
|
||
|
EXPECT
|
||
|
Use of EQ is deprecated at - line 5.
|
||
|
print() on closed filehandle main::STDIN at - line 6.
|
||
|
########
|
||
|
-W
|
||
|
# lint: check runtime $^W is zapped
|
||
|
$^W = 0 ;
|
||
|
close STDIN ; print STDIN "abc" ;
|
||
|
EXPECT
|
||
|
print() on closed filehandle main::STDIN at - line 4.
|
||
|
########
|
||
|
-W
|
||
|
# lint: check runtime $^W is zapped
|
||
|
{
|
||
|
$^W = 0 ;
|
||
|
close STDIN ; print STDIN "abc" ;
|
||
|
}
|
||
|
EXPECT
|
||
|
print() on closed filehandle main::STDIN at - line 5.
|
||
|
########
|
||
|
-W
|
||
|
# lint: check "no warnings" is zapped
|
||
|
no warnings ;
|
||
|
$a = $b = 1 ;
|
||
|
$a = 1 if $a EQ $b ;
|
||
|
close STDIN ; print STDIN "abc" ;
|
||
|
EXPECT
|
||
|
Use of EQ is deprecated at - line 5.
|
||
|
print() on closed filehandle main::STDIN at - line 6.
|
||
|
########
|
||
|
-W
|
||
|
# lint: check "no warnings" is zapped
|
||
|
{
|
||
|
no warnings ;
|
||
|
close STDIN ; print STDIN "abc" ;
|
||
|
}
|
||
|
EXPECT
|
||
|
print() on closed filehandle main::STDIN at - line 5.
|
||
|
########
|
||
|
-Ww
|
||
|
# lint: check combination of -w and -W
|
||
|
{
|
||
|
$^W = 0 ;
|
||
|
close STDIN ; print STDIN "abc" ;
|
||
|
}
|
||
|
EXPECT
|
||
|
print() on closed filehandle main::STDIN at - line 5.
|
||
|
########
|
||
|
-W
|
||
|
--FILE-- abc.pm
|
||
|
no warnings 'deprecated' ;
|
||
|
my ($a, $b) = (0,0);
|
||
|
1 if $a EQ $b ;
|
||
|
1;
|
||
|
--FILE--
|
||
|
no warnings 'uninitialized' ;
|
||
|
use abc;
|
||
|
my $a ; chop $a ;
|
||
|
EXPECT
|
||
|
Use of EQ is deprecated at abc.pm line 3.
|
||
|
Use of uninitialized value in scalar chop at - line 3.
|
||
|
########
|
||
|
-W
|
||
|
--FILE-- abc
|
||
|
no warnings 'deprecated' ;
|
||
|
my ($a, $b) = (0,0);
|
||
|
1 if $a EQ $b ;
|
||
|
1;
|
||
|
--FILE--
|
||
|
no warnings 'uninitialized' ;
|
||
|
require "./abc";
|
||
|
my $a ; chop $a ;
|
||
|
EXPECT
|
||
|
Use of EQ is deprecated at ./abc line 3.
|
||
|
Use of uninitialized value in scalar chop at - line 3.
|
||
|
########
|
||
|
-W
|
||
|
--FILE-- abc.pm
|
||
|
BEGIN {$^W = 0}
|
||
|
my ($a, $b) = (0,0);
|
||
|
1 if $a EQ $b ;
|
||
|
1;
|
||
|
--FILE--
|
||
|
$^W = 0 ;
|
||
|
use abc;
|
||
|
my $a ; chop $a ;
|
||
|
EXPECT
|
||
|
Use of EQ is deprecated at abc.pm line 3.
|
||
|
Use of uninitialized value in scalar chop at - line 3.
|
||
|
########
|
||
|
-W
|
||
|
--FILE-- abc
|
||
|
BEGIN {$^W = 0}
|
||
|
my ($a, $b) = (0,0);
|
||
|
1 if $a EQ $b ;
|
||
|
1;
|
||
|
--FILE--
|
||
|
$^W = 0 ;
|
||
|
require "./abc";
|
||
|
my $a ; chop $a ;
|
||
|
EXPECT
|
||
|
Use of EQ is deprecated at ./abc line 3.
|
||
|
Use of uninitialized value in scalar chop at - line 3.
|