I have the habit of starting each and every of my scripts with
use strict;
use warnings;
But some of the high-rep fellows here recommend
use warnings 'all';
If I understood them right, the latter is even better than the first. So I read through the docs and found
All warnings are enabled in a block by either of these:
use warnings; use warnings 'all';
Even the Camel Book says nothing different:
use warnings; # same as importing "all"
So
use warnings;
won't catch), orps -ef
vs. ps aux
? Some people use this while others prefer the other.use warnings; When the warning pragma is used, the compiler will check for errors, will issue warnings against the code, and will disallow certain programming constructs and techniques. This pragma sends a warning whenever a possible typographical error and looks for possible problems.
The warnings pragma gives control over which warnings are enabled in which parts of a Perl program. It's a more flexible alternative for both the command line flag -w and the equivalent Perl variable, $^W .
Currently,
use warnings;
is equivalent to
use warnings 'all';
However, there has been talk on perl5porters of changing it to mean
use warnings 'default';
New "less-critical" warnings would be added to the "all" category but not shown by default. Since it seems this change is seriously being considered, it's safer to use warnings 'all';
explicitly.
Previous discussions on p5p:
RFC: Support for new warning categories outside of "all"
I've added support for new warning categories outside of "all" to blead
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With