Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: Problem with Net::Telnet

by frozenwithjoy (Curate)
on Nov 26, 2012 at 01:36 UTC ( #1005539=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Problem with Net::Telnet
in thread Problem with Net::Telnet

Can you determine at which pattern match it is timing out based on the line # or printing debug statements to STDOUT between telnet calls?


Comment on Re^3: Problem with Net::Telnet
Re^4: Problem with Net::Telnet
by SDN (Initiate) on Nov 26, 2012 at 03:42 UTC
    Yes, it's right at line 24 where it times out.
    $telnet->waitfor('/$device# /i'); ##wait for prompt
    From the output I can see it authenticate, but once I get to the prompt it times out. My output file looks something like this:
    username: xxxx
    password: zzzz
    yyyy#

    Now if I remove $device and just enter a specific name followed by the prompt(#), it prints out exactly what I want. It's just when I try to use a variable I run into this problem.
    $telnet->waitfor('/yyyy# /i'); ##wait for prompt

    This works. Maybe it has something to do with the prompt? I removed "." from the line and it still times out.

      What if you use this:

      $telnet->waitfor("/$device# /i");   ##wait for prompt

      instead of this?:

      $telnet->waitfor('/$device# /i');   ##wait for prompt
      It looks like you forgot to chomp the line entered by user.
      It's also useful to protect arbitrary data in regexes by putting them between \Q and \E.
      Sorry if my advice was wrong.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005539]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-09-20 20:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (161 votes), past polls