good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I would consider inadvertently clearing $@ (or $!) as harmful, not the rethrowing. But there are so many places where this can happen.
Does bar() throw an exception itself? If it doesn't now will it sometime in the future? What about the stuff that bar() calls? What about the next version of the module Foo used by module Bar used by the bar() function? If you rely on $@ you're relying on everything in your exception handling code restoring it before you use it. Me - I'll copy it instead. Coupling bad. Sure the overloading thing is daft - but that doesn't mean copying $@ isn't the right thing to do. In reply to Re^2: Rethrowing with die $@ considered harmful
by adrianh
|
|