in reply to User interaction mid script again

What's wrong with the example in the Expect POD?
$exp->expect($timeout, [ qr/username: /i, sub { my $self = shift; $self->send("$username\r"); exp_continue; }], [ qr/password: /i, sub { my $self = shift; $self->send("$password\r"); exp_continue; }], $shell_prompt);
All you need to add before it is something like:
print "username: "; my $username = <STDIN>; print "password: "; my $password = <STDIN>; chomp $username; chomp $password;
I've never used Expect, but the POD seems pretty clear.

rdfield

Replies are listed 'Best First'.
Re: Re: User interaction mid script again
by markd (Acolyte) on Dec 04, 2003 at 17:01 UTC
    my question was to do with the use of the interact command in perl expect. This allows you to interact in real time with the script. I know that I can ask for the variables at the start of the script or even pass them in as parameters but I would like to know why the interact statement that I used does not work as all the documentation on it says it should. Becoming proficient with the expect.pm module means asking questions about some of the apparently unclear aspects of some of its functions