in reply to maximum result size for Net::Telnet's cmd() method

I have run into the same thing trying to gather up a couple hundred lines. I ended up getting it to work using print and waitfor. Using your example it would look like this:
$t->print("ps -elf"); @ps = $t->waitfor('/your_stuff/');
with 'your_stuff' being what you are looking for in the command. I found this in the the Network Programming with Perl book by Lincoln Stein. A quite handy book by the way. Hope this helps.

Replies are listed 'Best First'.
Re^2: maximum result size for Net::Telnet's cmd() method
by idsfa (Vicar) on Jun 12, 2006 at 14:31 UTC

    Which, if you actually read the source is exactly what cmd() does:

    ## Send command and wait for the prompt. $self->put($cmd . $ors) and ($lines, $last_prompt) = $self->waitfor($prompt);

    So no, there is no direct limit on the number of lines returned, only the indirect limit placed by the timeout.


    The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. — Cyrus H. Gordon