Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Use of "die" in OO modules

by theguvnor (Chaplain)
on Jan 18, 2007 at 21:59 UTC ( #595356=note: print w/replies, xml ) Need Help??


in reply to Re: Use of "die" in OO modules
in thread Use of "die" in OO modules

And I second the idea of not using a return code to signify what failed; I do however condone letting undef indicate that there is an error (that can be inspected some other, appropriate, way) if there's no potential for undef as a valid data return.

[Jon]

Replies are listed 'Best First'.
Re^3: Use of "die" in OO modules
by perrin (Chancellor) on Jan 18, 2007 at 22:14 UTC
    Uh, undef is a return code. I don't think that's any better than saying "79" indicates a failure.

      I said:

      a return code to signify what failed;

      (emphasis added).

      I fully realise that undef is a return code. It does not, however, carry information about what failed and why. The lack of defined return code is my signal to go off and look at my object/class and get the error.

      That works for me (and as bryan notes above, is somewhat common in CPAN modules).

      Your mileage might vary, as they say ;-)

      [Jon]

      mmm, 69 == success.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2019-12-07 02:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (160 votes). Check out past polls.

    Notices?