in reply to Re^6: Problem with Net::SSH::Expect on unavailable hosts
in thread Problem with Net::SSH::Expect on unavailable hosts
There are some other things that you should probably clean up in this example, like the poorly named $login_output and not checking the return value of the first eval (or $login_output for that matter). I'll assume you either plan to do that or were just a bit too aggressive in summarizing your code for this example.my $ssh = Net::SSH::Expect->new ( host => "$current_server", user => "$user", raw_pty => 1 ); # test the login eval { $login_output = $ssh->run_ssh(); }; # I've tried to capture $@ or $! here but it never gives me an +ything useful my $rc = eval{($ssh->read_all(2) =~ />\s*|$\s*\z/) or die "whe +re's the remote prompt?";}; unless($rc =~ /$your_expected_output_match_pattern/){ &MOVE_ON_TO_THE_NEXT_HOST; } $ssh->exec("stty raw -echo");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Problem with Net::SSH::Expect on unavailable hosts
by sierpinski (Chaplain) on Jul 02, 2009 at 16:22 UTC |