Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Net::Telnet::Cisco: nullifying first prompt in output for cmd() matching

by phydeauxarff (Priest)
on Oct 23, 2003 at 14:08 UTC ( [id://301589]=note: print w/replies, xml ) Need Help??


in reply to Net::Telnet::Cisco: nullifying first prompt in output for cmd() matching

We had a similar issue using net::telnet for managing Netscreen devices.

Fortunately, you can use the prompt method to account for pretty much whatever you want.

Check out the docs for net::telnet::cisco as they contain a more exacting description of what the prompt method is expecting...you should be able to append to this to account for the behavior of your devices.

  • Comment on Re: Net::Telnet::Cisco: nullifying first prompt in output for cmd() matching

Replies are listed 'Best First'.
Re: Re: Net::Telnet::Cisco: nullifying first prompt in output for cmd() matching
by bonoboy (Sexton) on Oct 23, 2003 at 14:42 UTC
    Actually, I don't think you can. From what I know, cmd() matches against the prompt. That's fine if the first time you see a prompt, it's been matched against a specific cmd or other call. What I'm talking about isn't the possibility of matching against a funky new prompt or something, which I kinda think is what you're suggesting. The problem I have is that there's a prompt which comes up *the second* I connect to the device. In other words, there's no way I can match against it and remove it from the buffered stream. And clearing the buffer doesn't beat that in my experience either. When you capture the output from a 'cmd()' the way it seems to work is that it reads the buffer of everything which has occurred in the telnet session so far. That buffer is matched against for every call made against the router, and every prompt is accordingly dealt with. So if you have a prompt appearing anywhere in the stream and it's not been matched, then all of your matched output will be one prompt behind. Sorry if you're dead right and I've missed it, but I can't see what the prompt documentation provides for other than matching against a given string.
    toeslikefingers.com - because you've got too much time on your hands
      $session->waitfor_pause(1) may be a workaround. /chAlx

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2024-04-19 08:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found