tags:

views:

211

answers:

1

I am trying to automate telnet to a Linux box which doesn't require any authentication through Net::Telnet Perl module. Here is a test script:

use strict;
use Net::Telnet;
my $telnet = new Net::Telnet ( Timeout=>10, Errmode=>'die',
                               host=> '10.104.20.200', port => 2004,
                             ); 
$telnet->print('ls');
my $output = $telnet->waitfor('/\$ $/i');
print $output;

When I execute this script, I get the below error,

pattern match timed-out at telnetPerl.pl line 7. 

As you could see, I am matching for any characters in waitfor. But I doubt whether the telnet connectivity happened in the first place.

+3  A: 

The Net::Telnet docs say under the entry for waitfor():

Use dump_log() to debug when this method keeps timing-out and you don't think it should.

What happened when you followed the doc's instructions? :)

brian d foy