"mark" <ma***********@yahoo.com> wrote in message news:<F-********************@www.bayou.com>...
i am attempting to write a script using Net::Telnet. The script telnets to
a machine
logs in and issues a command to list the config. Tthe output of the command
pauses
about every screenfull and gives the user the prompt " --More-- ". The
script
contains the followin code to account fot the prompt.
$telnet->waitfor('/-\-More\-\- $/i');
$telnet->print('\s');
the script does not proceed past the " --More-- " prompt. this problems
seems to have stumpt me. does anyone have any suggestions for me?
There could be several problems here.
First, input buffering could pose a problem. The Net::Telnet documentation
explicitly states that all input is buffered; in my limited testing,
the waitfor() method does indeed return lines that do *not* end with an
end-of-line, but I am not sure that this will always be the case.
In other words, the problem could be Net::Telnet's waitfor() not returning
until a whole line has been read, and the --More-- prompt does not really
contain a CR/LF at the end.
Second, are you sure that the string you should be matching for is
the exact sequence of characters '-', '-', 'M', 'o', 'r', 'e', etc?
I mean, some pagers use the "backspace convention" (for lack of a better
name that I can think of right now) to indicate bold, underline and such:
for bold, the pager outputs 'M', backspace, 'M'; for underline, it prints
'_', backspace, 'M'. If the '--More-- ' prompt is bold for some reason,
then '--More-- ' will probably not match it.
Those are two reasons that I can think of offhand.
G'luck,
Peter