Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Returning Error Codes

by ioannis (Prior)
on May 26, 2006 at 02:07 UTC ( #551744=note: print w/replies, xml ) Need Help??


in reply to Returning Error Codes

The Perly solution is to exploit the hash capability of the *@ glob -- it is a well-kept secret. You don't want the function to set a scalar or set an array. You want the function to set the 0 key of a hash -- it is easier to test the return value that way.

(Those who answered with die(), with 'best practices', or even with 'common practices' are avoiding to answer directly the poster's question.)

foo(); $@{0} ? print "error: $@{0}" : print 'ok'; sub foo { $@{0} = 'proxy error' }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://551744]
help
Chatterbox?
[Corion]: marto: A rough week comes to an end?
Corion has to finish off some test tickets and hopefully close them. Also I have to prepare some information for the tax people on the weekend :-/
[marto]: it feels like 2 weeks :)
[Discipulus]: sane dots for your weekend marto!

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2017-01-20 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (174 votes). Check out past polls.