Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Exceptions and Return Codes

by merlyn (Sage)
on Jun 29, 2001 at 17:45 UTC ( #92608=note: print w/replies, xml ) Need Help??

in reply to Exceptions and Return Codes

If a failure is a "normal" thing, a special return value is fine.

If a failure is an "exceptional" thing, I'd prefer a death that I can catch.

If extra information needs to be provided, I'd prefer a package-specific global, or (using recent Perl exceptions that can handle die $object), a death object which can be queried.

So there's no one "right answer". It really depends on how frequent and how complex the failure can get.

And as long as I'm on the soapbox, the wrong answer is "put it into $@", as some of the IO::* does. That's reserved for an eval failure, Graham. Usurping that was a bad idea. Bleh.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: Re: Exceptions and Return Codes
by agoth (Chaplain) on Jun 29, 2001 at 18:06 UTC
    AAAAAAAAAAAAArgh, but thank you,

    That last one has been bugging me all week, I've been wading through some old IO::Socket and IO::Select code and $@ was being checked a few times with no eval's or do's in sight
    And no mention in the perldoc that i could find either, thats one niggle less at least...


Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2023-12-02 06:30 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (13 votes). Check out past polls.