Re: Why does Net::SFTP trigger my die handler when no errors?



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
.



Relevant Pages

  • Re: Why does Net::SFTP trigger my die handler when no errors?
    ... Kindly consider, if you please, this trivial sample script ... I have defined a custom "die" handler. ... warnings are supressed; OTHERWISE they are ... > Why is Net::SFTP triggering my die handler when nothing seems to be ...
    (comp.lang.perl.misc)
  • Re: Inserting lines into text files, or howto "fix" vCards having no n: entry
    ... the same task) the specifics of my challenge and the script I am ... script parses a single Palm Desktop-exported vCard file having multiple ... or die "Cannot open '$sourcefilename' $!"; ...
    (comp.lang.perl.misc)
  • Re: finding compile time errors
    ... It looks a *lot* like the Perl DBI module which might be the ... Is there a die in PHP with an error message? ... Of course there's a way to kill a script with dieand an error ...
    (comp.lang.php)
  • Update von JMS zu B5:TLT
    ... Ein neues update-posting von JMS. ... Wer sich für die non-B5 Projekte von ... script, and we've now spoken to several of the original cast members, ... Also erstmal mit den Schauspielern verhandeln, die mitmachen ...
    (de.rec.sf.babylon5.misc)
  • Re: Unidentified Index Problem on some servers
    ... if you want the bugs now or the bugs later. ... script, ... >Also error reporting can be too high, ... >shouldn't die when encountering a notice, ...
    (comp.lang.php)