http://qs321.pair.com?node_id=1068472


in reply to Difference Between use warnings and use warnings FATAL => 'all'

It's always use warnings, sometimes just use warnings, and other times use warnings FATAL => 'all';, which is the same as use warnings qw( FATAL all );... just a cooler way of typing it.

One of the best ways to prevent bugs from creeping into a program is to write it with as much "questionable behavior" or "questionable practice" detection enabled as possible. This is why C compilers have strict modes, why Perl has strict, and so on. FATAL => all elevates to the level of throwing an exception when a warning occurs. It's like saying, "I want warnings to be exceptional situations." Stop everything, hold the horses, go directly to jail, do not pass go ----- we need to fix this!

There are times where STDERR is routed to a log file, where it won't be immediately seen by the developer or maintainer unless he goes looking for it. Perhaps it gets buried behind a bunch of other stuff that isn't relevant, and it becomes hard to determine the context under which the warning occurred. By stopping the run immediately, nothing else (or very little else) will be in the log. Context becomes more readily apparent.


Dave

Replies are listed 'Best First'.
Re^2: Difference Between use warnings and use warnings FATAL => 'all'
by Anonymous Monk on Dec 27, 2013 at 04:07 UTC

    This is why C compilers have strict modes,

    I believe this is the direct equivalent of strict/warnings-FATAL-all

    gcc -ansi -pedantic -Wall -Wextra ...

      gcc -ansi -pedantic -Wall -Wextra ...
      No, it's worse:
      gcc <various-warning-flags> -Wfatal-errors
      i.e. it stops at the first warning. In practice, this means that you get to fix/suppress the first warning your program causes, then start it over again to fix/suppress the second, etc., rather than getting a list of all of them and deciding what to do.