Re: [Ssh-sftp-perl-users] errors :(
Brought to you by:
dbrobins
From: Steve S. <sap...@gs...> - 2004-11-25 12:44:42
|
Mihai Secasiu wrote: > On Wednesday 24 November 2004 00:27, thefinn wrote: > >>I now get the "permission denied" and a complete exit of the program when >>the user/pass pairs are wrong. I'd like to change this to just have it give >>me some kind of error code. > > I needed the same thing and I modified some files to eliminate the call that > makes the script die ( fatal_disconnect ) . I placed the error in a session > string and it can be retrieved using a new method $ssh->get_error(); > If you want I will post this patch here. I talked to the maintainer of the > code and he is willing to let me incorporate this patch into the next > release. You can just put the call in an eval block and check the error code, something like this: eval { $ssh->login($user, $pass) }; if ($@) { warn "Loging failed: $@\n"; } -- Steve Sapovits |