in reply to How to break while reading data from a Cisco router?
Here is some example code for your situation;
my $timeout = 5; eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm $timeout; @data = $tnet->cmd('show ip cache flow'); alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; # propagate unexpected errors # timed out } else { # didn't }
|
---|