-Check lexical warning functionality
+Check lexical warnings functionality
TODO
check that the warning hierarchy works.
__END__
# check illegal category is caught
-use warning 'blah' ;
+use warnings 'blah' ;
EXPECT
unknown warning category 'blah' at - line 3
BEGIN failed--compilation aborted at - line 3.
########
# Check compile time scope of pragma
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
{
- no warning ;
+ no warnings ;
1 if $a EQ $b ;
}
1 if $a EQ $b ;
########
# Check compile time scope of pragma
-no warning;
+no warnings;
{
- use warning 'deprecated' ;
+ use warnings 'deprecated' ;
1 if $a EQ $b ;
}
1 if $a EQ $b ;
########
# Check runtime scope of pragma
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
{
- no warning ;
+ no warnings ;
my $b ; chop $b ;
}
my $b ; chop $b ;
########
# Check runtime scope of pragma
-no warning ;
+no warnings ;
{
- use warning 'uninitialized' ;
+ use warnings 'uninitialized' ;
my $b ; chop $b ;
}
my $b ; chop $b ;
########
# Check runtime scope of pragma
-no warning ;
+no warnings ;
{
- use warning 'uninitialized' ;
+ use warnings 'uninitialized' ;
$a = sub { my $b ; chop $b ; }
}
&$a ;
Use of uninitialized value at - line 6.
########
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
1 if $a EQ $b ;
EXPECT
Use of EQ is deprecated at - line 3.
1 if $a EQ $b ;
1;
--FILE--
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
require "./abc";
EXPECT
########
--FILE-- abc
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
1;
--FILE--
require "./abc";
########
--FILE-- abc
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
1 if $a EQ $b ;
1;
--FILE--
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
require "./abc";
my $a ; chop $a ;
EXPECT
########
--FILE-- abc.pm
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
1 if $a EQ $b ;
1;
--FILE--
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
use abc;
my $a ; chop $a ;
EXPECT
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval {
my $b ; chop $b ;
}; print STDERR $@ ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval {
- use warning 'uninitialized' ;
+ use warnings 'uninitialized' ;
my $b ; chop $b ;
}; print STDERR $@ ;
my $b ; chop $b ;
########
# Check scope of pragma with eval
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
eval {
my $b ; chop $b ;
}; print STDERR $@ ;
########
# Check scope of pragma with eval
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
eval {
- no warning ;
+ no warnings ;
my $b ; chop $b ;
}; print STDERR $@ ;
my $b ; chop $b ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval {
1 if $a EQ $b ;
}; print STDERR $@ ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval {
- use warning 'deprecated' ;
+ use warnings 'deprecated' ;
1 if $a EQ $b ;
}; print STDERR $@ ;
1 if $a EQ $b ;
########
# Check scope of pragma with eval
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
eval {
1 if $a EQ $b ;
}; print STDERR $@ ;
########
# Check scope of pragma with eval
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
eval {
- no warning ;
+ no warnings ;
1 if $a EQ $b ;
}; print STDERR $@ ;
1 if $a EQ $b ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval '
my $b ; chop $b ;
'; print STDERR $@ ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval q[
- use warning 'uninitialized' ;
+ use warnings 'uninitialized' ;
my $b ; chop $b ;
]; print STDERR $@;
my $b ; chop $b ;
########
# Check scope of pragma with eval
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
eval '
my $b ; chop $b ;
'; print STDERR $@ ;
########
# Check scope of pragma with eval
-use warning 'uninitialized' ;
+use warnings 'uninitialized' ;
eval '
- no warning ;
+ no warnings ;
my $b ; chop $b ;
'; print STDERR $@ ;
my $b ; chop $b ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval '
1 if $a EQ $b ;
'; print STDERR $@ ;
########
# Check scope of pragma with eval
-no warning ;
+no warnings ;
eval q[
- use warning 'deprecated' ;
+ use warnings 'deprecated' ;
1 if $a EQ $b ;
]; print STDERR $@;
1 if $a EQ $b ;
########
# Check scope of pragma with eval
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
eval '
1 if $a EQ $b ;
'; print STDERR $@;
########
# Check scope of pragma with eval
-use warning 'deprecated' ;
+use warnings 'deprecated' ;
eval '
- no warning ;
+ no warnings ;
1 if $a EQ $b ;
'; print STDERR $@;
1 if $a EQ $b ;
EXPECT
Use of EQ is deprecated at - line 8.
+########
+
+# Check the additive nature of the pragma
+1 if $a EQ $b ;
+my $a ; chop $a ;
+use warnings 'deprecated' ;
+1 if $a EQ $b ;
+my $b ; chop $b ;
+use warnings 'uninitialized' ;
+my $c ; chop $c ;
+no warnings 'deprecated' ;
+1 if $a EQ $b ;
+EXPECT
+Use of EQ is deprecated at - line 6.
+Use of uninitialized value at - line 9.
+Use of uninitialized value at - line 11.
+Use of uninitialized value at - line 11.