I am using net::telnet to connect to a modem pool and then connect with a remote piece of kit. Everything works fine normally, however on occassions the remote piece of kit may be busy and will not talk to me, leaving me to logoff cleanly and try again later.
Using net::telnet and the following code I am trying to wait for the prompt of ? to be returned if it is not returned after 60 seconds I wisk to run a sub that will basically log me off the device cleanly (failure to do so can leave the device port hung stopping further access until reset).
Expand|Select|Wrap|Line Numbers
- $telnet->cmd(String => "$level",
- Prompt =>'/USER:$/');
- $telnet->cmd(String => "$user",
- Prompt => '/KEY:$/');
- $connected = $telnet->cmd(String => "$pass",
- Prompt => '/\?/',
- Timeout => 60,
- Errmode => sub{&prompterr($params)} );
Can anyone point me in the direction as to where I have gone wrong? Have I completely misunderstood how to use this?!?!
Best regards
Steve