in reply to Re^4: Net::Telnet timed out when logging in
in thread Net::Telnet timed out when logging in

hm..the problem is there are 2 prompts
ENTER USERNAME < ENTER PASSWORD <
after i type my username in then the password prompt comes out

Replies are listed 'Best First'.
Re^6: Net::Telnet timed out when logging in
by regexes (Hermit) on Apr 18, 2008 at 09:07 UTC
    Try just the "<"... that's the last thing on the prompt line. If that doesn't solve the issue then you will need to analyze the dump_log files and see where it's timing out.
    use Net::Telnet; my $telnet3; $telnet3 = new Net::Telnet(timeout => 10, Errmode => 'die' Prompt => '/</'); $telnet3->open('10.200.16.58'); $telnet3->login('IATEST', 'TESTBED'); @lines = $telnet3->cmd("who");
    regexes
Re^6: Net::Telnet timed out when logging in
by glide (Pilgrim) on Apr 18, 2008 at 09:14 UTC
    Hi,

    You need to read the Net::Telnet documentation, and do, at least, a small configuration of the module.

    $telnet = new Net::Telnet(timeout => 10, # do not you the 'return' Errmode => 'die', # change the prompt Prompt => '/ </$'); # I'm gue +ssing this prompt ' <' $telnet->input_log($log_file); $telnet->dump_log($dump_file); $telnet->waitfor( -match => qr{ENTER USERNAME} ); $telnet->print($username); $telnet->waitfor( -match => qr{ENTER PASSWORD} ); $telnet->print($passard); # # and finally send a command @lines = $t->cmd("who"); for (@lines) { print }