Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: Re: Re: Weird Warning

by Sifmole (Chaplain)
on Jun 25, 2001 at 23:33 UTC ( [id://91398]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Weird Warning
in thread Weird Warning

I respectfully disagree...

Just because you "know" why, and don't feel like updating your conditionals, etc -- imagine 3 months or more down the line someone else has to support the code. They will not "know" the same thing you do.

The more complete, easier to maintain method (IMO) is to update your conditionals...

if ($foo{'test'} eq 'bar') { } # Becomes # exists could be defined depending on circumstances. if ( (exists $foo{'test'}) && ($foo{'test'} eq 'bar') ) { }
This code now makes it explicit to future maintainers that there is a possibility that the code could be querying non-existent data, and that this is an expected behavior (expected because the code supports it).

I would personally rather see the conditionals, etc updated rather than seeing warnings being flipped on and off throughout the code.

Plus, the questioner was obviously new to using hashes and was making a mistake with their use of them. So your answer to turn off the warnings would have resulted in the hiding of an error, the error that you "knew" was not there and "fully understood" the reason for.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-25 08:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found