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
|
Check default warnings
__END__
# default warnings should be displayed if you don't add anything
# optional shouldn't
my $a = oct "7777777777777777777777777777777777779" ;
EXPECT
Integer overflow in octal number at - line 3.
########
# no warnings should be displayed
no warnings ;
my $a = oct "7777777777777777777777777777777777778" ;
EXPECT
########
# all warnings should be displayed
use warnings ;
my $a = oct "7777777777777777777777777777777777778" ;
EXPECT
Integer overflow in octal number at - line 3.
Illegal octal digit '8' ignored at - line 3.
Octal number > 037777777777 non-portable at - line 3.
########
# check scope
use warnings ;
my $a = oct "7777777777777777777777777777777777778" ;
{
no warnings ;
my $a = oct "7777777777777777777777777777777777778" ;
}
my $c = oct "7777777777777777777777777777777777778" ;
EXPECT
Integer overflow in octal number at - line 3.
Illegal octal digit '8' ignored at - line 3.
Octal number > 037777777777 non-portable at - line 3.
Integer overflow in octal number at - line 8.
Illegal octal digit '8' ignored at - line 8.
Octal number > 037777777777 non-portable at - line 8.
########
# all warnings should be displayed
use warnings ;
my $a = oct "0xfffffffffffffffffg" ;
EXPECT
Integer overflow in hexadecimal number at - line 3.
Illegal hexadecimal digit 'g' ignored at - line 3.
Hexadecimal number > 0xffffffff non-portable at - line 3.
########
# all warnings should be displayed
use warnings ;
my $a = oct "0b111111111111111111111111111111111111111111111111111111111111111112";
EXPECT
Integer overflow in binary number at - line 3.
Illegal binary digit '2' ignored at - line 3.
Binary number > 0b11111111111111111111111111111111 non-portable at - line 3.
########
# Check scope of pragma with eval
use warnings;
{
no warnings ;
eval '
my $a = oct "0xfffffffffffffffffg" ;
'; print STDERR $@ ;
my $a = oct "0xfffffffffffffffffg" ;
}
EXPECT
########
# Check scope of pragma with eval
use warnings;
{
no warnings ;
eval q[
use warnings ;
my $a = oct "0xfffffffffffffffffg" ;
]; print STDERR $@;
my $a = oct "0xfffffffffffffffffg" ;
}
EXPECT
Integer overflow in hexadecimal number at (eval 1) line 3.
Illegal hexadecimal digit 'g' ignored at (eval 1) line 3.
Hexadecimal number > 0xffffffff non-portable at (eval 1) line 3.
########
# Check scope of pragma with eval
no warnings;
{
use warnings ;
eval '
my $a = oct "0xfffffffffffffffffg" ;
'; print STDERR $@ ;
}
EXPECT
Integer overflow in hexadecimal number at (eval 1) line 2.
Illegal hexadecimal digit 'g' ignored at (eval 1) line 2.
Hexadecimal number > 0xffffffff non-portable at (eval 1) line 2.
########
# Check scope of pragma with eval
no warnings;
{
use warnings;
eval '
no warnings ;
my $a = oct "0xfffffffffffffffffg" ;
'; print STDERR $@ ;
}
EXPECT
########
# Check scope of pragma with eval
no warnings;
{
use warnings 'deprecated' ;
eval '
my $a = oct "0xfffffffffffffffffg" ;
'; print STDERR $@;
}
EXPECT
|