http://www.perlmonks.org?node_id=1026217

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\xset.pl 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

    Anonymous:

    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.)

    ...roboticus

    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);