From: R. Craw on
I have a script that I am automating where occasionally the script requires
manual user input. If I simply tell expect.pm to send default values (\n),
the scripts work fine. However, when I remove one of the checks and wish the
user running the expected automated script to be allowed to manually enter
one of the script queries, the perl/expect script just sits there after the
user has entered the values. I expect (sorry) that I need to be using a
manual tty function within the expect call, but am unsure. Looking for
guidance on how to allow a manual user input value within an expect
automated input call.

Sample code follows, the commented section is the field I wish to allow the
user running the script to be able to manually enter the code:

$exp->expect($timeout,
[ qr/ENTER to continue/ =>
sub {
my $exp = shift;
sleep 1;
$exp->send("\n");
exp_continue;
}
],
[ qr/\[\/usr\/local\] / =>
sub {
my $exp = shift;
sleep 1;
$exp->send("\n");
exp_continue;
}
],
# [ qr/Activation code \:/ =>
# sub {
# my $exp = shift;
# sleep 1;
# $exp->send("\n");
# exp_continue;
# }
# ],
[ qr/ENTER to quit/ =>
sub {
my $exp = shift;
sleep 1;
$exp->send("\n");
exp_continue;
}
],
);
$exp->soft_close();