|Perl Monk, Perl Meditation|
Annoying warnings...by tlm (Prior)
|on Jul 15, 2005 at 20:08 UTC||Need Help??|
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':
The other annoying warning is "Name ... used only once: possible typo...". For this I do this song-and-dance:
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