From: Blackstone, J. D. <jda...@ci...> - 2001-12-11 15:52:30
|
Hmm, you can't exp_continue from a timeout handler. Here's a (really crummy) patch to allow it. A better way would probably be to move the timeout handler stuff into READLOOP somehow... jdb --- /usr/local/perl561/lib/site_perl/5.6.1/Expect.pm Wed Aug 22 06:08:15 2001 +++ Expect.pm Tue Dec 11 09:46:08 2001 @@ -539,10 +539,12 @@ my $match; my @matchlist; +TIMEOUT_CONT_LOOP: +while (1) { # Set the last loop time to now for time comparisons at end of loop. my $start_loop_time = time(); my $exp_cont = 1; - + $err = ""; READLOOP: while ($exp_cont) { $exp_cont = 1; @@ -805,18 +807,27 @@ if ($timeout_hook) { print STDERR ("Calling timeout function $timeout_hook...\r\n") if ($Expect::Debug or $Expect::Exp_Internal); + my $timeout_cont = 0; if (ref($timeout_hook) eq 'CODE') { - &{$timeout_hook}($_[0]->[0]); + $timeout_cont = &{$timeout_hook}($_[0]->[0]); } else { if ($#{$timeout_hook} > 3) { - &{$timeout_hook->[3]}($_[0]->[0], + $timeout_cont = &{$timeout_hook->[3]}($_[0]->[0], @{$timeout_hook}[4..$#{$timeout_hook}]); } else { - &{$timeout_hook->[3]}($_[0]->[0]); + $timeout_cont = &{$timeout_hook->[3]}($_[0]->[0]); } } + if ($timeout_cont and ($timeout_cont eq "exp_continue")) + { + print STDERR ("Continuing expect, restarting timeout...\r\n") + if ($Expect::Debug); + next TIMEOUT_CONT_LOOP; + } } } +last TIMEOUT_CONT_LOOP; +} # Tell us status if ($Expect::Debug or $Expect::Exp_Internal) { |