Net::Telnet not working with perl 5.8.5

Net::Telnet not working with perl 5.8.5

am 15.11.2005 11:48:26 von Kiran Kumar Gahlot

Hi,

I am working on a test framework which uses "Net::Telnet" module to
connect to remote machines. This framework started failing after I
upgraded to perl 5.8.5 on Linux "2.6.9-5.EL".

After a little investigation, I found that the problem is with the
Telnet module. I tried following sample program given at site,
http://search.cpan.org/~jrogers/Net-Telnet-3.03/lib/Net/Teln et.pm :

==================================
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/bash\$ $/',
Dump_Log => '/tmp/telnetdump/test.dump',
);
$t->open("localhost");
my $username="nz";
my $passwd="nz";
$t->login($username, $passwd);
@lines = $t->cmd("who");
print @lines;
==================================

This program fails 98% of the time with following error and works
properly for the rest of the time:
--------
timed-out waiting for password prompt at /tmp/try.pl line 9
--------

If I increase the timeout value to 60 then I get following error:

--------
eof read waiting for password prompt: nz at /tmp/try.pl line 9
--------

Perl version is " v5.8.5 built for x86_64-linux-thread-multi", Linux
version is "Linux 2.6.9-5.EL #1 Wed Jan 5 19:21:57 EST 2005 x86_64
x86_64 x86_64 GNU/Linux". This program is working fine on Perl version
"v5.6.1 built for i386-linux" with Linux version "Linux
2.4.9-e.49enterprise #1 SMP Fri Aug 6 11:32:58 EDT 2004 i686". I am
using 3.03 version of Net::Telnet.

Regards,
Kiran

Re: Net::Telnet not working with perl 5.8.5

am 24.11.2005 10:21:42 von Kiran Kumar Gahlot

This problem is solved. The solution is to sleep for 2 seconds before
putting username and password. Details can be found at following
location:

http://groups.google.co.in/group/comp.lang.perl.modules/brow se_thread/thread/e639bf9a52cf565/07bea1a35c1962f0?lnk=st&q=c omp.lang.perl.modules+Net%3A%3ATelnet&rnum=10#07bea1a35c1962 f0

Regards,
Kiran