jxh has asked for the wisdom of the Perl Monks concerning the following question:
This seems to me to be the wrong way around, ie returns true when using a username that fails. More importantly, is there a better way of doing this ? ( sorry but I cant use Net::SSH::Perl ) NB - Not shown, but STDERR is saved off to a temp handle, and restored afterwards. Thanks.close(STDERR) # ie I Dont want to see junk if ( &Net::SSH::ssh('user_that_fails@somehost', "exit") ) { print "A message - you just failed \n"; } else { print "A message - you just passed \n"; }
Considered by jdporter: reap: dupe of Connection test : Net::SSH::Perl : $ssh->login - detecting failure
Unconsidered by Arunbear: keep (and edit) votes prevented reaping; Keep: 3, Edit: 1, Reap: 17
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is there a better way ? : Net::SSH - Detecting success or fail for a connection
by u235sentinel (Hermit) on Feb 18, 2006 at 02:20 UTC |