my $exception = try { ... } || { $$_; }; $ssh->exit_session; $ssh->close_session; $exception and $exception->throw;