Perlfect Solutions
 

[Perlfect-search] Why it is not stable?

Attiah, Ibrahim A perlfect-search@perlfect.com
Sun, 24 Nov 2002 09:39:18 +0300
The below code worked fine and gave the desired result many time but
suddenly started to return the same earlier error message "timed-out
waiting for command prompt at perliaa5b.pl line 8". I used to get this
message before 
Until I got a help from lgbarr@bb.com.br to add the Prompt setting to
the code as it appear below. Please help. Thank you.


use Net::Telnet;
my $Telnet = new Net::Telnet; 
my $InHandle = $Telnet->input_log("inlog.txt"); 
my $OutHandle = $Telnet->output_log("outlog.txt"); 
my $prmpt = '/[\w().-]*[\$#>:.]\s?(?:\(enable\))?\s*$/'; 
$telnet = new Net::Telnet (Timeout=>40, Prompt => $prmpt,
Errmode=>'die'); $telnet->open('xx.xx.xxx.xxx');
$telnet->login('user','user'); @lines= $telnet->cmd("Networking"); 
@lines= $telnet->cmd("IP");
@lines= $telnet->cmd("ipmac");
print STDOUT @lines;
$telnet->close;