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

Hmmm... what prompt do you receive when you log in using a telnet client from the command line, i.e. without using perl?

regexes
  • Comment on Re^2: Net::Telnet timed out when logging in

Replies are listed 'Best First'.
Re^3: Net::Telnet timed out when logging in
by poolboi (Acolyte) on Apr 18, 2008 at 06:40 UTC
    alright the prompt i get is as such below
    Trying 010200016058....Open ENTER USERNAME <
    after i type in my username
    i get
    ENTER PASSWORD <
    i'm telneting into a proprietary swtich which makes things really difficult
      Try something like this below. Since you know what the prompt is when logging in manually, use it during creation of the object.
      use Net::Telnet; my $telnet3; $telnet3 = new Net::Telnet(timeout => 10, Errmode => 'die' Prompt => '/ENTER USERNAME </'); $telnet3->open('10.200.16.58'); $telnet3->login('IATEST', 'TESTBED'); @lines = $telnet3->cmd("who"); open(FILE, ">file.txt"); print FILE ("@lines\n"); print("logged in to the device.\n");
      Maybe that helps?

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