in reply to Catching die in Net::SFTP / Net::SSH::Perl:
Well, anyway, you can also use Net::SFTP::Foreign. It will not die on that kind of errors:
my $sftp = Net::SFTP::Foreign->new($::config{'ahost'}, user => $::config{'auser'}, password => $::config{'apass'}, more => [ 'ConnectTimeout 30', 'ServerAliveInterval 20', 'ServerAliveCountMax 3' ] ); if ($sftp->error) { $self->{error} = "Unable to open SFTP connection: " . $sftp->error +; return; } $self->{sftp} = $sftp;
|
|---|