in reply to Re^3: Where did $@ go?
in thread Where did $@ go?
So, the classic code as shown in the Camel Book simply can't work. If you don't use Try::Tiny (or compatible system? Do they interoperate properly?), you can only use $@ once.
Now, as I'm updating my idioms, I'll just use Try::Tiny. And if editing old code, it might be necessary to assign $@ to a local first, and change subsequent uses. If a function changes so it throws a fancy object now, or uses Moose in the new version, old code that calls something that calls something that calls the function which throws an exception will be broken.
IMO, This specific case (stringification and boolification of the exception object) should take more care not to clobber $@. After all, one of the things Try::Tiny claims to do is localize $@. The guts of the Failure object needs to use that!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Where did $@ go?
by JavaFan (Canon) on Mar 22, 2011 at 07:27 UTC | |
|
Re^5: Where did $@ go?
by ikegami (Patriarch) on Mar 22, 2011 at 07:02 UTC |