What I mean is that you should let your exceptions go uncouth for upper levels where they can be handled properly. There is no reason to couple the exception catching with the cleanup code.
Oh that, yes, I assume foo is the topmost level
If it isn't, rethrow
my $exception = try { ... } || { $$_; }; $ssh->exit_session; $ssh->close_session; $exception and $exception->throw;
Rethrow versus Guard? Eeeh :)
In reply to Re^7: exiting a subroutine neatly (Throwable)
by Anonymous Monk
in thread exiting a subroutine neatly
by Mavebe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |