j1n3l0 has asked for the wisdom of the Perl Monks concerning the following question:

Hi all

According to perl5120delta you can switch warnings on via an environment variable PERL5OPT in perl 5.12 and greater. Is it possible to make these warnings FATAL as you would by doing the following in a script:

use warnings 'FATAL' => 'all';

Thanks :)


Smoothie, smoothie, hundre prosent naturlig!

Replies are listed 'Best First'.
Re: How to make all warnings FATAL via PERL5OPT
by Anonymous Monk on Apr 13, 2012 at 02:33 UTC

    -Mwarnings=FATAL,all

    $ perl -Mwarnings=FATAL,all -le " printf qq/%s %s / , 1, 2; print q/hi +/;" 1 2 hi $ perl -Mwarnings=FATAL,all -le " printf qq/%s %s / , 1; print q/hi/;" Missing argument in printf at -e line 1.
Re: How to make all warnings FATAL via PERL5OPT
by educated_foo (Vicar) on Apr 12, 2012 at 23:10 UTC
    Yes it is. You want to first turn that "use" line into a command-line option, then put that in the PERL5OPT environment variable. See perlrun for details