in reply to Telnet.pm error

Just a guess but, I recently encountered a situation whereby I had a script login to a number of switches using Net::Telnet - most of which worked, the rest didn't so much hang, as wait for an awfully long timeout before the script 'came back' - the problem was that the prompt was subtly different on some of the switches.

HTH ,

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: Telnet.pm error
by Anonymous Monk on Aug 13, 2008 at 16:14 UTC
    Ok, this one is solved. Thanks for the help. It definitely was hanging on the prompt.

    The following is from the perldoc telnet document.

    * The methods "login()" and "cmd()" use the *prompt* setting in the object to determine when a login or remote command is complete. Those methods will fail with a time-out if you don't set the prompt correctly.

    ########################################################

    Here's the change I made to my code. I added the Prompt=>'/Bilbo>$/i', line.

    my $telnet = new Net::Telnet ( Timeout=>10, Prompt=>'/Bilbo>$/i', Errmode=>'die', Dump_Log=>'dump.txt', Input_log=>'input.txt', Output_log=>'output.txt', );