in reply to Interactive input via telnet

You can try something like this:
$telnet->print("/opt/bea/tuxedo8.1/bin/tmloadcfGPPconfig.ubb"); my ($prematch,$match) = $telnet->waitfor( -match => $telnet->prompt, # to wait for the + regular prompt -match => qr{\[y,\s*q\]}, # wait for the [y +, q] prompt ); $telnet->cmd("y") if ($match =~ qr{\[y,\s*q\]} );

Replies are listed 'Best First'.
Re^2: Interactive input via telnet
by Noame (Beadle) on Nov 05, 2007 at 13:59 UTC
    First, thanks for your quick answer. I got the following error in your code:
    missing opening delimiter of match operator in argument "(?-xism:/\[y, +\s*q\]/)" given to Net::Telnet::waitfor() at C:\Documents and Settings\yonae\wor +kspace\Dat abase_Connection\try.pl line 32
    Can you please advice. moreover, in this case I "know" for which question to wait for and sent the answer "y"... But, How can I write interactive code according to the input that I'll get? mean to present to the user the question and according to him choice to send the answer. Thanks.
      O can use a more generic match (like: /\s\?\s*$/) and then use the $prematch var to question the user about the prompt.