Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Unexpected warnings in log file.

by TexasTess (Beadle)
on Aug 09, 2002 at 20:22 UTC ( [id://189030]=note: print w/replies, xml ) Need Help??


in reply to Unexpected warnings in log file.

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Re: Unexpected warnings in log file.
by ChemBoy (Priest) on Aug 09, 2002 at 21:35 UTC

    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

    return defined(WebPageParameter($Hash->{$Entry}->{2}, $Hash->{0}->{2 +})) && defined(WebPageParameter($Hash->{$Entry}->{3}, $Hash->{0}->{3 +})) && defined(WebPageParameter($Hash->{$Entry}->{4}, $Hash->{0}->{4 +})) && defined(WebPageParameter($Hash->{$Entry}->{5}, $Hash->{0}->{5 +})) && defined(WebPageParameter($Hash->{$Entry}->{6}, $Hash->{0}->{6 +})) && defined(WebPageParameter($Hash->{$Entry}->{7}, $Hash->{0}->{7 +}));

    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:

    if ( defined(WebPageParameter($Hash->{$Entry}->{2}, $Hash->{0}->{2 +})) && defined(WebPageParameter($Hash->{$Entry}->{3}, $Hash->{0}->{3 +})) && defined(WebPageParameter($Hash->{$Entry}->{4}, $Hash->{0}->{4 +})) && defined(WebPageParameter($Hash->{$Entry}->{5}, $Hash->{0}->{5 +})) && defined(WebPageParameter($Hash->{$Entry}->{6}, $Hash->{0}->{6 +})) && defined(WebPageParameter($Hash->{$Entry}->{7}, $Hash->{0}->{7 +})) ) { return 1; } else { return; }

    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

      Well, to nitpick with your solution I really dont see why you would type all that stuff
      !defined(WebPageParameter($Hash->{$Entry}->{$_}, $Hash->{0}->{$_})) && + return for 2..7; return 1
      Its not like this is time critical or anything.

      Yves / DeMerphq
      ---
      Software Engineering is Programming when you can't. -- E. W. Dijkstra (RIP)

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://189030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-24 02:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found