Subject: | Missing return code if sftp-connect fails |
Distribution name and version: Net-SFTP-Foreign-0.57
Perl version: "This is perl, v5.8.5 built for sun4-solaris"
Operating System vendor and version: SunOS 5.8 Generic_117350-25 sun4u sparc SUNW,Sun-Fire-V240 Solaris
(Problem also exists on Linux, with same perl- an distribution-version)
I'm missing an appropriate return code from Net::SFTP::Foreign->new()
Assume the following code:
#!/usr/local/bin/perl -w
use strict;
use Net::SFTP::Foreign;
my $sftp;
if ( !($sftp = Net::SFTP::Foreign->new(
"myhost",
warn => 0,
debug => 0,
user=> "myuser"
#, more => ["-vvv"]
)) ) {
print STDERR "ERROR\n";
exit 1;
}
undef $sftp;
exit 0;
And execute:
$ ./fmysftp.pl
Permission denied (publickey,keyboard-interactive).
reading from ssh pipe failed () at ./fmysftp.pl line 6
$ echo $?
0
An exit-code 0 really makes no sense here. How am I able to check if connection was successfully or not?