HeffaK has asked for the wisdom of the Perl Monks concerning the following question:
sometimes one of the boxes doesn't answer for one reason or another and the program dies with the error message "timed-out waiting for login prompt at ..." How do I catch the timeout error and continue looping through the rest of the boxes?
Here's part of the code
while(<IN>){
chomp ($num = $_);
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/.*# $/') or warn "timeout\n"; #this doesn't work.
$t->open("10.0.0.$num") || die "can't telnet to $num\n";
$t->login('$login','$pwd');
Thanks HeffaK
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Catching timeout for Net::Telnet
by no_slogan (Deacon) on May 09, 2001 at 22:13 UTC | |
by HeffaK (Initiate) on May 09, 2001 at 22:41 UTC | |
by no_slogan (Deacon) on May 09, 2001 at 23:00 UTC | |
by HeffaK (Initiate) on May 10, 2001 at 00:03 UTC | |
|
Re: Catching timeout for Net::Telnet
by danichka (Hermit) on May 10, 2001 at 00:10 UTC | |
|
Re: Catching timeout for Net::Telnet
by TeKk9 (Scribe) on May 10, 2001 at 00:05 UTC |