Re: Why does Net::SFTP trigger my die handler when no errors?
- From: xhoster@xxxxxxxxx
- Date: 31 Jan 2006 16:08:31 GMT
usenet@xxxxxxxxxxxxxxx wrote:
> Greetings. Kindly consider, if you please, this trivial sample script
> which illustrates my question:
>
> #!/usr/bin/perl
> use warnings; use strict;
> use Net::SFTP;
>
> local $SIG{__DIE__} = sub {
> print "Oh no - I'm dead!\n";
> };
I think it would be nice, at least for debugging purposes, if you had your
sub print out the error message it was called with. Then you would know
what it was.
....
>
> As you see, I have defined a custom "die" handler. For some reason,
> when I run this script, I get three "die" messages from this handler,
> even though the script successfully does the "put" and cleanly exits
> with the polite message.
>
> Why is Net::SFTP triggering my die handler when nothing seems to be
> dying?
You should ask Perl that, not us!
However, from perldoc perlvar:
Due to an implementation glitch, the $SIG{__DIE__} hook is
called even inside an eval(). Do not use this to rewrite a
pending exception in $@, or as a bizarre substitute for
over- riding CORE::GLOBAL::die(). This strange action at a
distance may be fixed in a future release so that
$SIG{__DIE__} is only called if your program is about to
exit, as was the original intent. Any other use is
deprecated.
So it would be my guess that Net::SFTP is dying from inside an eval, as
part of its normal course of business, and you are intercepting those dies.
But this lead me to ask a broader question. What are you trying to do, and
why are you using a SIG die handler, rather than eval{}, to do whatever it
is you are tyring to do?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
.
- Follow-Ups:
- Re: Why does Net::SFTP trigger my die handler when no errors?
- From: usenet
- Re: Why does Net::SFTP trigger my die handler when no errors?
- From: A. Sinan Unur
- Re: Why does Net::SFTP trigger my die handler when no errors?
- References:
- Prev by Date: Re: security alerts
- Next by Date: Re: Why does Net::SFTP trigger my die handler when no errors?
- Previous by thread: Re: Why does Net::SFTP trigger my die handler when no errors?
- Next by thread: Re: Why does Net::SFTP trigger my die handler when no errors?
- Index(es):
Relevant Pages
|