Check FATAL functionality __END__ # Check compile time warning use warnings FATAL => 'syntax' ; { no warnings ; $a =+ 1 ; } $a =+ 1 ; print STDERR "The End.\n" ; EXPECT Reversed += operator at - line 8. ######## # Check compile time warning use warnings FATAL => 'all' ; { no warnings ; my $a =+ 1 ; } my $a =+ 1 ; print STDERR "The End.\n" ; EXPECT Reversed += operator at - line 8. ######## # Check runtime scope of pragma use warnings FATAL => 'uninitialized' ; { no warnings ; my $b ; chop $b ; } my $b ; chop $b ; print STDERR "The End.\n" ; EXPECT Use of uninitialized value $b in scalar chop at - line 8. ######## # Check runtime scope of pragma use warnings FATAL => 'all' ; { no warnings ; my $b ; chop $b ; } my $b ; chop $b ; print STDERR "The End.\n" ; EXPECT Use of uninitialized value $b in scalar chop at - line 8. ######## # Check runtime scope of pragma no warnings ; { use warnings FATAL => 'uninitialized' ; $a = sub { my $b ; chop $b ; } } &$a ; print STDERR "The End.\n" ; EXPECT Use of uninitialized value $b in scalar chop at - line 6. ######## # Check runtime scope of pragma no warnings ; { use warnings FATAL => 'all' ; $a = sub { my $b ; chop $b ; } } &$a ; print STDERR "The End.\n" ; EXPECT Use of uninitialized value $b in scalar chop at - line 6. ######## --FILE-- abc $a =+ 1 ; 1; --FILE-- use warnings FATAL => 'syntax' ; require "./abc"; EXPECT ######## --FILE-- abc use warnings FATAL => 'syntax' ; 1; --FILE-- require "./abc"; $a =+ 1 ; EXPECT ######## --FILE-- abc use warnings 'syntax' ; $a =+ 1 ; 1; --FILE-- use warnings FATAL => 'uninitialized' ; require "./abc"; my $a ; chop $a ; print STDERR "The End.\n" ; EXPECT Reversed += operator at ./abc line 2. Use of uninitialized value $a in scalar chop at - line 3. ######## --FILE-- abc.pm use warnings 'syntax' ; $a =+ 1 ; 1; --FILE-- use warnings FATAL => 'uninitialized' ; use abc; my $a ; chop $a ; print STDERR "The End.\n" ; EXPECT Reversed += operator at abc.pm line 2. Use of uninitialized value $a in scalar chop at - line 3. ######## # Check scope of pragma with eval no warnings ; eval { use warnings FATAL => 'uninitialized' ; my $b ; chop $b ; }; print STDERR "-- $@" ; my $b ; chop $b ; print STDERR "The End.\n" ; EXPECT -- Use of uninitialized value $b in scalar chop at - line 6. The End. ######## # Check scope of pragma with eval use warnings FATAL => 'uninitialized' ; eval { my $b ; chop $b ; }; print STDERR "-- $@" ; my $b ; chop $b ; print STDERR "The End.\n" ; EXPECT -- Use of uninitialized value $b in scalar chop at - line 5. Use of uninitialized value $b in scalar chop at - line 7. ######## # Check scope of pragma with eval use warnings FATAL => 'uninitialized' ; eval { no warnings ; my $b ; chop $b ; }; print STDERR $@ ; my $b ; chop $b ; print STDERR "The End.\n" ; EXPECT Use of uninitialized value $b in scalar chop at - line 8. ######## # Check scope of pragma with eval no warnings ; eval { use warnings FATAL => 'syntax' ; $a =+ 1 ; }; print STDERR "-- $@" ; $a =+ 1 ; print STDERR "The End.\n" ; EXPECT Reversed += operator at - line 6. ######## # Check scope of pragma with eval use warnings FATAL => 'syntax' ; eval { $a =+ 1 ; }; print STDERR "-- $@" ; $a =+ 1 ; print STDERR "The End.\n" ; EXPECT Reversed += operator at - line 5. ######## # Check scope of pragma with eval use warnings FATAL => 'syntax' ; eval { no warnings ; $a =+ 1 ; }; print STDERR $@ ; $a =+ 1 ; print STDERR "The End.\n" ; EXPECT Reversed += operator at - line 8. ######## # Check scope of pragma with eval no warnings ; eval { use warnings FATAL => 'syntax' ; }; print STDERR $@ ; $a =+ 1 ; print STDERR "The End.\n" ; EXPECT The End. ######## # Check scope of pragma with eval no warnings ; eval q[ use warnings FATAL => 'uninitialized' ; my $b ; chop $b ; ]; print STDERR "-- $@"; my $b ; chop $b ; print STDERR "The End.\n" ; EXPECT -- Use of uninitialized value $b in scalar chop at (eval 1) line 3. The End. ######## # Check scope of pragma with eval use warnings FATAL => 'uninitialized' ; eval ' my $b ; chop $b ; '; print STDERR "-- $@" ; my $b ; chop $b ; print STDERR "The End.\n" ; EXPECT -- Use of uninitialized value $b in scalar chop at (eval 1) line 2. Use of uninitialized value $b in scalar chop at - line 7. ######## # Check scope of pragma with eval use warnings FATAL => 'uninitialized' ; eval ' no warnings ; my $b ; chop $b ; '; print STDERR $@ ; my $b ; chop $b ; print STDERR "The End.\n" ; EXPECT Use of uninitialized value $b in scalar chop at - line 8. ######## # Check scope of pragma with eval no warnings ; eval q[ use warnings FATAL => 'syntax' ; $a =+ 1 ; ]; print STDERR "-- $@"; $a =+ 1 ; print STDERR "The End.\n" ; EXPECT -- Reversed += operator at (eval 1) line 3. The End. ######## # Check scope of pragma with eval use warnings FATAL => 'syntax' ; eval ' $a =+ 1 ; '; print STDERR "-- $@"; print STDERR "The End.\n" ; EXPECT -- Reversed += operator at (eval 1) line 2. The End. ######## # Check scope of pragma with eval use warnings FATAL => 'syntax' ; eval ' no warnings ; $a =+ 1 ; '; print STDERR "-- $@"; $a =+ 1 ; print STDERR "The End.\n" ; EXPECT Reversed += operator at - line 8. ######## # TODO ? !$Config{usethreads} && $::UTF8 && ($ENV{PERL_DESTRUCT_LEVEL} || 0) > 1 ? "Parser leaks OPs, which leak shared hash keys" : '' use warnings 'void' ; time ; { use warnings FATAL => qw(void) ; $a = "abc"; length $a ; } join "", 1,2,3 ; print "done\n" ; EXPECT Useless use of time in void context at - line 4. Useless use of length in void context at - line 9. ######## # TODO ? !$Config{usethreads} && $::UTF8 && ($ENV{PERL_DESTRUCT_LEVEL} || 0) > 1 ? "Parser leaks OPs, which leak shared hash keys" : '' use warnings ; time ; { use warnings FATAL => qw(void) ; $a = "abc"; length $a ; } join "", 1,2,3 ; print "done\n" ; EXPECT Useless use of time in void context at - line 4. Useless use of length in void context at - line 9. ######## use warnings FATAL => 'all'; { no warnings; my $b ; chop $b; { use warnings ; my $b ; chop $b; } } my $b ; chop $b; print STDERR "The End.\n" ; EXPECT Use of uninitialized value $b in scalar chop at - line 8. Use of uninitialized value $b in scalar chop at - line 11. ######## use warnings FATAL => 'all'; { no warnings FATAL => 'all'; my $b ; chop $b; { use warnings ; my $b ; chop $b; } } my $b ; chop $b; print STDERR "The End.\n" ; EXPECT Use of uninitialized value $b in scalar chop at - line 8. Use of uninitialized value $b in scalar chop at - line 11. ######## use warnings FATAL => 'all'; { no warnings 'syntax'; { use warnings ; my $b ; chop $b; } } my $b ; chop $b; print STDERR "The End.\n" ; EXPECT Use of uninitialized value $b in scalar chop at - line 7. ######## use warnings FATAL => 'syntax', NONFATAL => 'void' ; $a = "abc"; length $a; print STDERR "The End.\n" ; EXPECT Useless use of length in void context at - line 5. The End. ######## use warnings FATAL => 'all', NONFATAL => 'void' ; $a = "abc"; length $a; print STDERR "The End.\n" ; EXPECT Useless use of length in void context at - line 5. The End. ######## use warnings FATAL => 'all', NONFATAL => 'void' ; my $a ; chomp $a; $b = "abc" ; length $b; print STDERR "The End.\n" ; EXPECT Useless use of length in void context at - line 7. Use of uninitialized value $a in scalar chomp at - line 4. ######## use warnings FATAL => 'void', NONFATAL => 'void' ; $a = "abc"; length $a; print STDERR "The End.\n" ; EXPECT Useless use of length in void context at - line 4. The End. ######## # TODO ? !$Config{usethreads} && $::UTF8 && ($ENV{PERL_DESTRUCT_LEVEL} || 0) > 1 ? "Parser leaks OPs, which leak shared hash keys" : '' use warnings NONFATAL => 'void', FATAL => 'void' ; $a = "abc"; length $a; print STDERR "The End.\n" ; EXPECT Useless use of length in void context at - line 4. ######## use warnings FATAL => 'all', NONFATAL => 'io'; no warnings 'once'; open(F, " 'all', NONFATAL => 'io', FATAL => 'unopened' ; no warnings 'once'; open(F, "