tlm has asked for the wisdom of the Perl Monks concerning the following question:
I normally run my code with use warnings, but there are a couple of warnings that I find quite annoying. The first one is "Use of unitialized value in string blah blah blah ...", which occurs in common expressions such as
the subexpression in question (e.g. reftype $x) happens to evaluate to undef. I take care of this with the ol':reftype $x eq 'HASH'
( reftype $x or '' ) eq 'HASH'
The other annoying warning is "Name ... used only once: possible typo...". For this I do this song-and-dance:
$DB::single = $DB::single = 1;
The thing is that, even though 99% of the time these warnings are just a PITA, ocassionally they do serve the intended purpose of flagging errors, so I'm reluctant to turn them off wholesale. And the solution of turning them off "locally", which usually requires rolling out a block just for the purpose, is even more awkwards than the kluges shown above.
But hope springs eternal!
Has any of you, by any chance, found a more clueful approach to dealing with these annoying warnings?
the lowliest monk
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Annoying warnings...
by jbisbee (Pilgrim) on Jul 15, 2005 at 22:01 UTC | |
by tlm (Prior) on Jul 15, 2005 at 23:54 UTC | |
Re: Annoying warnings...
by Zaxo (Archbishop) on Jul 15, 2005 at 20:19 UTC | |
Re: Annoying warnings...
by kwaping (Priest) on Jul 15, 2005 at 23:31 UTC | |
Re: Annoying warnings...
by gam3 (Curate) on Jul 16, 2005 at 00:02 UTC | |
by Mr. Muskrat (Canon) on Jul 16, 2005 at 00:35 UTC | |
Re: Annoying warnings...
by schwern (Scribe) on Jul 16, 2005 at 23:13 UTC | |
Re: Annoying warnings...
by schwern (Scribe) on Jul 16, 2005 at 23:27 UTC | |
Re: Annoying warnings...
by adrianh (Chancellor) on Jul 16, 2005 at 14:56 UTC | |
Re: Annoying warnings...
by Smylers (Pilgrim) on Jul 16, 2005 at 10:03 UTC | |
by adrianh (Chancellor) on Jul 16, 2005 at 14:51 UTC | |
by tlm (Prior) on Jul 16, 2005 at 13:07 UTC | |
Re: Annoying warnings...
by sfink (Deacon) on Jul 16, 2005 at 17:37 UTC |