Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, I am new to perl. Could someone help me in using waitfor command from following code, i tried a lot but could not succeed and code is timing out at line 6.
use Net::Telnet; $telnet->open('godavari.bec.ge.com'); $telnet->login ('anand','anand'); $telnet->waitfor('/\$ $/i'); $telnet->cmd("./EJS1.3.7.0/ejs/solaris/setup -console"); $telnet->waitfor('/ Continue $/i') or die "Can't find enter to contin +ue", $telnet->lastline; $telnet->print(''); $telnet->close; exit;
How do i write a waitfor statement if my input log displays following lines on executing setup as on line 5 in the code.
InstallShield Wizard
Initializing InstallShield Wizard...
Preparing Java(tm) Virtual Machine...
................................... ................................... ................................... ................................... .............. Running InstallShield Wizard...
Welcome to the InstallShield Wizard for Enterprise JMS Server.
The InstallShield Wizard will install Enterprise JMS Server on your computer.
To continue, click Next.
Enterprise JMS Server
Please press Enter to Continue
Kindly help me in modifying line no 6 of the code.

edited: Mon Jun 21 17:56:53 2004 by jeffa - code tags

Replies are listed 'Best First'.
Re: Problem in usage of waitfor in Telnet module
by Happy-the-monk (Canon) on Jun 21, 2004 at 15:42 UTC

    At first glance the simple fix could be to eliminate the trainling space after "Continue":

    -   / Continue $/i
    +   /Continue/

    Cheers, Sören

Re: Problem in usage of waitfor in Telnet module
by tele2mag (Initiate) on Jun 21, 2004 at 18:08 UTC
    Hello, I'm pretty new here too ;)
    I don't know exactly what your trying to match on line 6
    $telnet->waitfor('/ Continue $/i') or die "Can't find enter to continu +e", $telnet->lastline;
    Supply me with a string to match that line with.
    If the execution of your telnet program (wizard or what it is) is slow, telnet socket may timeout. The default timeout is only 10seconds so you know. You can change it on the fly. Like this:
    $telnet->timeout(30); # for a 30 second timeout $telnet->waitfor('/ Continue $/i'); $telnet->timeout(10); # reset timeout to 10 second
    Don't know if it helps. Or supply me with more info.
    Good luck