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
In reply to Catching timeout for Net::Telnet by HeffaK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |