in reply to yes/no prompt

Thanks Eric. I have been trying to get Expect to work, but again, my knowledge is weak at best. I have not worked Expect into the script yet. I left the question general because I was looking for a general answer.

What I would like to know is if Expect is the route I should take or if there is another way. I am using system to start up the VPN client:
$login="vpnclient.exe connect \"VPN NAME\" user \"username\" pwd \"pas +sword\" "; system ("exit"); system ($login);
After the connection is secure, I get a "Do you wish to continue prompt? y/n." This is probably not the best way to do it. It is simple and amateur, but jumping into Expect is pretty far above my head right now. If Expect is the only way, then I will dig in and read up, but I was looking for options on how else I can run the vpn client or get past the y/n prompt.

Replies are listed 'Best First'.
Re^2: yes/no prompt
by madbombX (Hermit) on Sep 04, 2006 at 10:58 UTC
    Expect is the way to go in my opinion (based on the little information that you provided. I would dig in and get it working with that. Unless someone has already written a PM that works with the VPN client that you are using.

    Eric

Re^2: yes/no prompt
by friedo (Prior) on Sep 04, 2006 at 17:39 UTC
    Expect's interface is a little weird, but once you get it working it should be pretty easy. Something like the following should work:

    use Expect; system('exit'); my $exp = Expect->new; $exp->spawn( 'vpnclient.exe connect "VPN NAME" user "username" pwd "password"' ); $exp->expect( 10, [ qr/Do you wish to continue/i => sub { $exp->send('y'); $exp->exp_continue; } ] );