Net::Telnet not working with perl 5.8.5

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


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, :

use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
                      Prompt => '/bash$ $/',
                      Dump_Log   => '/tmp/telnetdump/test.dump',
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/ line 9

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

   eof read waiting for password prompt: nz at /tmp/ 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.

Re: Net::Telnet not working with perl 5.8.5

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


Site Timeline