in reply to Net::SSH2 Connect - Does not return error
Net::SSH2 has a function "error" which returns the last error. In scalar context, it returns the error code and in list context, it returns long error messages also.
my $ssh2 = Net::SSH2->new(); $ssh2->connect($rip) ( $code, $error_name, $error_string ) = $ssh2->error(); if ( $code ); # $code will be false (undef) if there is NO error. { print "$code: $error_name: $error_string \n"; #format as you wish :) exit(); } ... <rest of your code>
Cheers !
--VC
|
|---|