in reply to Re^7: Net::SSH2 test connection to remote host
in thread Net::SSH2 test connection to remote host
That's an opinion shared by others, but other people disagree. See for instance a thread about this on p5p this summer. Note that if DESTROY wouldn't propagate changes to $@, $! or $? DESTROY would be different from other functions, because $@, $! and $? behave differently. It also means you can have code that throws an exception, but afterwards $@ isn't set (your local $@ suffers from the same problem):
butsub one::DESTROY { die "foo\n"; } eval {my $x = bless [], 'one'}; say "\$\@ = $@"; __END__ $@ = (in cleanup) foo
This is far from ideal as well, and I doubt it's much better than the current situation.sub one::DESTROY { local $@; die "foo\n"; } eval {my $x = bless [], 'one'}; say "\$\@ = $@"; __END__ $@ =
People have suggested a new variable, @@, where new errors get pushed onto, instead of having them override $@. But noone has written a patch to actually do this.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: Net::SSH2 test connection to remote host
by salva (Canon) on Oct 01, 2008 at 10:30 UTC |