[sf-perl] use {strict,warnings}
David Thompson
dat1965 at yahoo.com
Mon Mar 3 17:03:24 PST 2008
--- frosty <biztos at mac.com> wrote:
> I actually find it useful sometimes, but on average more annoying than useful.
>
> The useful thing is that it reminds me to be clearer in things like printing and
> logging:
>
> use strict;
> use warnings;
Does this help your situation any?
use warnings;
no warnings qw(uninitialized);
See http://perldoc.perl.org/perllexwarn.html
and perldiag
> my $nope = undef;
> printf "You set it to '%s'\n", $nope; # warns.
> printf "You set it to '%s'\n", $nope || 'UNDEF'; # better.
>
> But:
>
> my $stuff = join( "fee", "fi", "fo", $nope ); # warns, annoying (to me).
> die "$nope would be nice"; # warns, annoying (to me).
>
> On the one hand I wish undefined values could be auto-vivified to 'UNDEF' in warn and
> die, but on the other hand that's probably sqlplus poisoning my brain.
>
> The problem, I find, with disabling warnings is that my list of annoying warnings may
> not be the same as my colleague's list. That plus you have nobody to blame but
> yourself when you screw up.
>
> The problem with *not* doing that is there is plenty of CPAN code that spews warnings
> all over your log files if you happen to have any.
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
More information about the SanFrancisco-pm
mailing list