Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Rethrowing with die $@ considered harmful

by Tanktalus (Canon)
on Jul 18, 2006 at 04:11 UTC ( [id://561920]=note: print w/replies, xml ) Need Help??


in reply to Rethrowing with die $@ considered harmful

I have to wonder ... would P5P consider fixing the code to match the documentation? I have to admit that your first ("wrong") example DWIMs better than the ("right") second example.

Obviously, then, one has to change - either the docs or the code - based on this discovery. I just think it should be the code.

  • Comment on Re: Rethrowing with die $@ considered harmful

Replies are listed 'Best First'.
Re^2: Rethrowing with die $@ considered harmful
by diotalevi (Canon) on Jul 18, 2006 at 05:04 UTC

    The latter is the generally recommended usage. Just deal. Anything that triggers perl code could clear $@. I wouldn't have normally thought to guard against an overloaded $@ but I suppose that's possible too. In general, when examining $@ you are always expected to copy it out.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      Generally recommended usage? I can easily find where ysth points out that the recommended usage is the first example. I can even find where, in perlcall, G_KEEPERR is mentioned to work around this issue from XS code (I think - I don't completely grok the internals). Where is it "generally recommended" to use the latter method? And would the rest of us notice it against the backdrop of perlcompile, perlembed (x2), perlform, and perlop giving examples such as the former?

        I didn't look in the docs. I recall this most clearly from when I was looking at Exception::Class. Hmm. It became abundantly clear *then* that you always, always, always copy $@. Perhaps it isn't in our docs.

        ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-24 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found