in reply to Re: Rethrowing with die $@ considered harmful
in thread Rethrowing with die $@ considered harmful

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.

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

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

Replies are listed 'Best First'.
Re^3: Rethrowing with die $@ considered harmful
by Tanktalus (Canon) on Jul 18, 2006 at 13:24 UTC

    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.

      ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊