Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^5: Strange problem with Config::General

by Eily (Hermit)
on Nov 18, 2013 at 17:50 UTC ( #1063173=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Strange problem with Config::General
in thread Strange problem with Config::General

You nearly always want to use the low precedence or instead of || for this kind of statments. In your case, with precedence being what it is, you actually have : %config = ($conf->getall || die "message");. That probably doesn't look like what you meant.

With or %config = $conf->getall or die; means (%config = $conf->getall) or die; so getall is called in list context.

That would still mean that you would die on an empty config (%config = ()). And instead of using or you could just add parenthesis when needed, but I find it clearer when the low precedence operator are used for control flow, and high precedence ones are used when the return value is used.

NB: your problem is, with a few meaningless differences, one of the exemples given in Logical or and Exclusive Or to show the meaning of both operators.


Comment on Re^5: Strange problem with Config::General
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2014-08-30 00:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (289 votes), past polls