开发者

How can I debug my Perl Net::Telnet program?

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 $ou开发者_运维知识库tput = $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.


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? :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜