1Check default warnings 2 3__END__ 4# default warnings should be displayed if you don't add anything 5# optional shouldn't 6my $a = oct "7777777777777777777777777777777777779" ; 7EXPECT 8Integer overflow in octal number at - line 3. 9######## 10# no warnings should be displayed 11no warnings ; 12my $a = oct "7777777777777777777777777777777777778" ; 13EXPECT 14######## 15# all warnings should be displayed 16use warnings ; 17my $a = oct "7777777777777777777777777777777777778" ; 18EXPECT 19Integer overflow in octal number at - line 3. 20Illegal octal digit '8' ignored at - line 3. 21Octal number > 037777777777 non-portable at - line 3. 22######## 23# check scope 24use warnings ; 25my $a = oct "7777777777777777777777777777777777778" ; 26{ 27 no warnings ; 28 my $a = oct "7777777777777777777777777777777777778" ; 29} 30my $c = oct "7777777777777777777777777777777777778" ; 31EXPECT 32Integer overflow in octal number at - line 3. 33Illegal octal digit '8' ignored at - line 3. 34Octal number > 037777777777 non-portable at - line 3. 35Integer overflow in octal number at - line 8. 36Illegal octal digit '8' ignored at - line 8. 37Octal number > 037777777777 non-portable at - line 8. 38######## 39# all warnings should be displayed 40use warnings ; 41my $a = oct "0xfffffffffffffffffg" ; 42EXPECT 43Integer overflow in hexadecimal number at - line 3. 44Illegal hexadecimal digit 'g' ignored at - line 3. 45Hexadecimal number > 0xffffffff non-portable at - line 3. 46######## 47# all warnings should be displayed 48use warnings ; 49my $a = oct "0b111111111111111111111111111111111111111111111111111111111111111112"; 50EXPECT 51Integer overflow in binary number at - line 3. 52Illegal binary digit '2' ignored at - line 3. 53Binary number > 0b11111111111111111111111111111111 non-portable at - line 3. 54######## 55 56# Check scope of pragma with eval 57use warnings; 58{ 59 no warnings ; 60 eval ' 61 my $a = oct "0xfffffffffffffffffg" ; 62 '; print STDERR $@ ; 63 my $a = oct "0xfffffffffffffffffg" ; 64} 65EXPECT 66 67######## 68 69# Check scope of pragma with eval 70use warnings; 71{ 72 no warnings ; 73 eval q[ 74 use warnings ; 75 my $a = oct "0xfffffffffffffffffg" ; 76 ]; print STDERR $@; 77 my $a = oct "0xfffffffffffffffffg" ; 78} 79EXPECT 80Integer overflow in hexadecimal number at (eval 1) line 3. 81Illegal hexadecimal digit 'g' ignored at (eval 1) line 3. 82Hexadecimal number > 0xffffffff non-portable at (eval 1) line 3. 83######## 84 85# Check scope of pragma with eval 86no warnings; 87{ 88 use warnings ; 89 eval ' 90 my $a = oct "0xfffffffffffffffffg" ; 91 '; print STDERR $@ ; 92} 93EXPECT 94Integer overflow in hexadecimal number at (eval 1) line 2. 95Illegal hexadecimal digit 'g' ignored at (eval 1) line 2. 96Hexadecimal number > 0xffffffff non-portable at (eval 1) line 2. 97######## 98 99# Check scope of pragma with eval 100no warnings; 101{ 102 use warnings; 103 eval ' 104 no warnings ; 105 my $a = oct "0xfffffffffffffffffg" ; 106 '; print STDERR $@ ; 107} 108EXPECT 109 110######## 111 112# Check scope of pragma with eval 113no warnings; 114{ 115 use warnings 'deprecated' ; 116 eval ' 117 my $a = oct "0xfffffffffffffffffg" ; 118 '; print STDERR $@; 119} 120EXPECT 121 122