Perl Net::Telnet timing out on large command output -
i'm writing programme utilize net::telnet
, when seek utilize $tel->cmd
in line 41, error occurs.
command timed-out @ coyotebridge4000.pl line 41
the comand valid, output big, that's why think time-out occurs. can solve that?? since i've tried alter timeout , doesn't solve problem.
#!/usr/bin/perl utilize net::telnet (); $tel = new net::telnet(); print "\nfile name\n\n"; $name = <>; chomp $name; @equipament; $i = 0; $username = "admin"; $passwd = "zhone"; $certo = 0; $co = "bridge show vlan 4000"; open(arquivo, "ip.txt"); $i = 0; while (<arquivo>) { $equipament[$i] = $_; chomp $equipament[$i]; $i++; } close(arquivo); open(resp, ">$name.csv"); foreach (@equipament) { eval { $tel->open($_); }; if ($@) { chomp $_; print resp "$_, unreachable\n"; } else { open(re, ">temp.txt"); $tel->login($username, $passwd); ###error### @lines = $tel->cmd(string => "$co", timeout => 600); #####error##### print re @lines; close(re); open(re, "temp.txt"); $encontrar = ":"; while (<re>) { if ($_ =~ /$encontrar/) { chomp $_; print resp $_; } } close(re); } } close(resp); print "\n\n done \n\n";
have tried using timeout alternative in constructor?
from pod:
net::telnet->new(-timeout => 20);
the value in seconds. suspect might having command time out waiting response command. default timeout 10 seconds.
perl telnet perl-module
No comments:
Post a Comment