Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't use warnings FATAL => 'all' seem to work?

This script:

use warnings FATAL => 'all';

warn 'warning';
die 'death';

...results in 'warning' getting logged, but doesn't die at that point, instead dying with 'death'.

I have a mod_perl module that overrides $main::SIG{__DIE__} to basically spit out die() messages to the browser during development, but it does not touch SIG{__WARN__}, so what is happening here?

This is on perl 5.10.1 on Windows Server 2003, with "-w" in PerlSwitches.

like image 487
Kev Avatar asked Jun 11 '13 14:06

Kev


1 Answers

It doesn't seem to work because your test isn't testing what you want to test. Try this:

use warnings FATAL => 'all';

print undef;
die 'death';

Just as a no warnings will not prevent warn from working, warnings FATAL will not make warn die.

like image 176
innaM Avatar answered Oct 08 '22 16:10

innaM