Spent some time chatting with Ben Trott regarding interaction of his Net::SSH::Perl module and the $SIG{__DIE__} and $SIG{__WARN__} handlers.
As it stands now (i.e. version 1.23), your script will bite the dust if you try to use both his module and the signal handlers because of "eval".
I got around this by modifying 3 of his modules (RSA.pm, Cipher.pm and Auth.pm), and making 'local' copies of the signal handlers within the appropriate subroutines (making them undef). I probably just should have done it once, in the constructor, but I was led around by the debugger and once I got it working I didn't feel like going back.
Of course, after tinkering with this nonsense for a couple of hours I thought to myself, "$self, do you think that there might be a module out there that deals with this?". Naturally, I found one (only just recently written) called Sig::PackageScoped that deals with just this situation.
As it stands it could probably be handled better than just sending ssh errors to the ether (i.e. ignoring them), since I might actually want to trap those someday as well. I've suggested this idea to Ben, and he seems to like it.
Re:Some light reading
djberg96 on 2002-01-08T15:13:19
Not a very helpful comment. Why is it considered harmful? Is it because of its interaction with 'eval'?
perlvar lists this as a bug, and not one anyone seems to be too concerned with fixing. Given that more than one author uses this paradigm, I need a little more detail.Re:Some light reading
djberg96 on 2002-04-24T15:26:29
Ok - did you update this post? I don't remember it being a link to anything (hence my first post).What are your feelings on doing something like:
*CORE::GLOBAL::die = sub{...handler ... } Re:Some light reading
Matts on 2002-04-24T15:50:09
I had this conversation once with Stas Bekman... Personally I think that overriding CORE::GLOBAL::die is even worse, because it probably breaks the case where some other module actually *does* use objectified exceptions. And overriding core functions should probably be done with utmost caution.
I talked a bit about a possible solution here on perlmonks. But it still doesn't protect you against the stupidity of others.