Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Telnet cmd command

by Anonymous Monk
on Mar 30, 2013 at 01:14 UTC ( #1026217=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, $telnetAC->cmd('show'); When I execute the command , the system prompts with the "----More---" and waits for the user to touch any of the keys in the keyboard to move on the next screen. So perl times out the program after executing the command "command timed-out at C:\Learn_perl\ line 176" I need help from you guys, on how to get rid of the "---more---" using the telnet module in perl. Thanks

Replies are listed 'Best First'.
Re: Telnet cmd command
by roboticus (Chancellor) on Mar 30, 2013 at 01:41 UTC


    I'm not familiar with the show command, but perhaps one of these will help:

    • Read the show documentation, and see if it offers a switch to prevent paging.
    • Set the LINES environment variable to something very large. The pager might be fooled into thinking that the page is longer than the text you're retrieving.
    • Check the default login environment to see if it's insinuating a pager between you and your data. (Example: show might be a shell function that calls a utility and pipes it through more, or some such.)


    When your only tool is a hammer, all problems look like your thumb.

Re: Telnet cmd command
by NetWallah (Canon) on Mar 30, 2013 at 06:02 UTC
    As roboticus suggests - you probably need to tell the device you are connecting to - not to page.

    For Cisco devices, you need to send a command like:

    terminal length 0
    So - if you do that immediately after your login, subsequent requests will not get paged responses.

                 "I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
            -- Dr. Cox, Scrubs

Re: Telnet cmd command
by regexes (Hermit) on Mar 30, 2013 at 13:56 UTC
    Maybe as an alternative, consider sending back want is being requested, i.e. a response. That should cause the rest of the output to be delivered.

    It's mentioned quite often in the Net::Telnet documentation to use print() and waitfor() when the cmd() function does not do what you want it to.

    Since the carriage feed is added automatically, try just sending back any character.

    As an example... (note this is untested)
    $string = "show"; $thost->print($string); $thost->waitfor('----More---') $anykey = "b"; $thost->print($anykey);

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1026217]
Approved by kcott
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2018-03-18 22:33 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (231 votes). Check out past polls.