dgalati000 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, newbie here. I am using NET:Telnet:Cisco to telnet to and log into Cisco CAT-OS and Cisco IOS switches. I receive an error and bomb out ONLY when connecting to a CAT-OS switch and then attempt to progress past the username and password field. The issues is: the CAT-OS has a delay when producing/displaying the 'username' and 'password' prompts (Cisco IOS serves up these two fields immediately and the problem does not appear on IOS switches). I want to modify the Cisco.pm to insert a wait or pause or sleep so that it waits a few secs for the username prompt to appear before proceeding, same wait for the password prompt. I have ID'd several areas in the .pm that I believe are the approp. routine/sub-routine, but don't know how to add the waitfor or sleep. Can someone offer a fix? Don't know how to add the .pm text here?? too newbie, but need help!! thx a bunch in advance.
  • Comment on help add a sleep or waitfor into NET:Telnet:Cisco

Replies are listed 'Best First'.
Re: help add a sleep or waitfor into NET:Telnet:Cisco
by Illuminatus (Curate) on Feb 19, 2009 at 22:18 UTC
    You have tried setting the 'timeout' value associated with the login, right?
    $session->login (name=>"admin", password=>"default", timeout=>30);
    Maybe you could provide a code snippet of what is not working, if this is not your problem?
      morning, pasting in the code from the code I'm working off of. Error msg is at line 42 (pattern match) >> $session->login(Name => $username, Password => $userpassword); YOUR suggestion relates to line 41 and that reads Timeout uses the scalar of $secs....which I've tried to manipulate. thank you for the comeback. $secs = 30; my $session = Net::Telnet::Cisco->new(Host => $ip_address, Timeout => $secs);