Asterix <lange.gerh...@gmail.com> asked:
> I've made a little script to capture the output of networking
> devices.
> Everything works fine, until I use the "show tech" command in an Cisco
> device.

Have you considered using the cmd() method of Net::Telnet? It has the option to 
individually set a reply timeout for each command:

#!/usr/bin/perl -w

use strict;
use Net::Telnet;

my $host = '42.42.42.42';
my $sysname = 'cisco';
my $login_pw = 'letmein';
my $enable_pw = 'secret';

my $tn = Net::Telnet->new( Host => $host ) ){
$tn->waitfor( '/word: $/' );
$tn->cmd( String => $login_pw, Prompt => "/$sysname>\$/" );
$tn->cmd( String => 'enable', Prompt => '/word: $/' );
$tn->prompt( "/$sysname#\$/" );
$tn->cmd( String => $enable_pw );
$tn->cmd( String => 'terminal length 0' );
my @data = $tn->cmd( String => 'show tech', Timeout => 60 );
print @data;

__END__

Works fine for me on a 7206. YMMV.

HTH,
Thomas

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to