Now the question is how can I interactively enter carriage return "\r".
Not quite sure whether you want the paging to continue by literally entering CR on the terminal from which you ran the script (i.e. by interactively pressing ^M), or whether you want the script to automatically send CR. In case of the latter, have you tried put() after the waitfor()?
$telnet->put("\r");
| [reply] [d/l] [select] |
There is a CPAN Module Net::Telnet::Cisco that works very well under most cases. The module handles the paging. Also, as long as the device behaves like Cisco CLI you should be OK.
Normally, on current Cisco devices, the prompt waiting on a paging is '--More--', and responding with a CR, "\r", returns only the next line of output, but responding with a Space, " ", returns the next page or the remaining text.
Good luck. -c
| [reply] |
Please read the formatting directions at the bottom of the posting box--especially the one about putting <code></code>tags around your code.
Algorithmically, what you probably need to do is waitfor either the "CR to continue" string or the prompt, and loop back as long as you keep getting the former.
| [reply] [d/l] [select] |
As told in previous posts - Net::Telnet::Cisco - is the way to go (judging by your "show ip route" command I'm guessing your on a Cisco device). The Net::Telnet::Cisco module has an autopaging feature; however, I've never gotten it to work.
The *solution* is that after connecting, the first command you issue should be "terminal length 0". This effectively turns off paging in the router and eliminates the need for the -More- prompt catching and RETURN pressing.
| [reply] |