![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Re: Unexpected warnings in log file.by ChemBoy (Priest) |
on Aug 09, 2002 at 21:35 UTC ( #189062=note: print w/replies, xml ) | Need Help?? |
Why? The current code is perfectly valid. The only reason I know of to use the &sub syntax (other than playing nasty games with @_, which I don't often see) is to distinguish your own subs from the built-ins, which is already taken care of in this case by the mixed-case subroutine name. If I were to pick nits at that code, I would say that return undef unless ... should be replaced with return unless ... , since return with no arguments produces undef in any case, in scalar context, and will behave sensibly in list context as well (which return undef will not--and thanks to chromatic for reminding me of that). If I were really in a mood to pick nits, I would say that much more typing went into that code than was strictly necessary: assuming you just need to return truth or falsehood, it can be reduced to
In this case, the calling code seems to test for definedness instead of truth--I'd rather change that test, but if that's undesirable, just change the above to this:
As to your actual problem, the message means that at the 29th line of the code supplied to the 13th eval call (presumably in some other module, possibly CGI.pm), you hit an uninitialized value. If you really want to know, you should run the script on the command line in the debugger: when it hits the warning, it will (I think) print a stack trace, which should allow you to track down the problem. If God had meant us to fly, he would *never* have given us the railroads. --Michael Flanders
In Section
Seekers of Perl Wisdom
|
|