Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^3: Net::Telnet blocks

by roboticus (Chancellor)
on Jul 19, 2010 at 17:38 UTC ( #850298=note: print w/replies, xml ) Need Help??

in reply to Re^2: Net::Telnet blocks
in thread Net::Telnet blocks


I just tried it out, and had a similar problem. Using the following code, I tried to connect to a local box:

#!/usr/bin/perl use strict; use warnings; use Net::Telnet; my @lines; my $t = new Net::Telnet( Timeout=>10, Prompt=>'/# $/', Dump_Log=>'NetTelnet_x.log' ); $t->open(""); $t->login("foo", undef); @lines = $t->cmd("ls"); print @lines;

It was hanging on the login, as you described. When it finally timed out, I got the message:

timed-out waiting for password prompt at ./ line 13

Well, my local box doesn't have a password on the foo account[1], so it never prompts for password. I just changed the login line to read:


and it started to work. Perhaps you have the same problem? (I notice that you don't quote the error message anywhere, so I can't tell. The one error message you *did* give was a match timeout from when you were playing with regular expressions.)

You might try logging in step by step with the cmd() function and verify that the login process is working as you expect. Then you can fix the login() call if you find a surprise.



[1] I don't run Telnet servers (except for the few minutes for this test), so 733t h@X0r2[1] need not get their hopes up...

[1] Synonym for "script kiddie".

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://850298]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2018-03-17 23:26 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (227 votes). Check out past polls.