No such thing as a small change | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
The section from perllexwarn that you might find most interesting comes under the headline, "What's wrong with -w and $^W":
Although very useful, the big problem with using -w on the command line to enable warnings is that it is all or nothing. Take the typical scenario when you are writing a Perl program. Parts of the code you will write yourself, but it's very likely that you will make use of pre-written Perl modules. If you use the -w flag in this case, you end up enabling warnings in pieces of code that you haven't written. The section then goes on to describe how $^W falls short of providing lexical scoping for -w. For simple code snippets, -w and use warnings are synonymous. But for more elaborate code, and scripts that use modules, or scripts that need lexical control over warnings, the pragma is preferable over the command-line switch.
Dave In reply to Re: use of -w and warnings
by davido
|
|