chime has asked for the wisdom of the Perl Monks concerning the following question:
use Expect; # use strict; # commented out to allow program to run for now # Spawn program using perl expect module my $exp = Expect->spawn($run_program) or die "Cannot spawn $run_program: $!\n"; # Turn off output of results from stdout $exp->log_stdout(1); # Wait for runrep to initialise $exp->expect(600,[ qr/Read in all files/]); $exp->send("runprogram $report_name $output_format \n"); # Wait for report to run or generate an error $exp->expect(600, [ qr/Error/i, sub { my $self = shift; $self->send("quit\n"); print ("program.pl has an error: $_ \n"); exp_continue; }], # *** [ qr/Report run successful./i, sub { my $self = shift; $self->send("quit\n"); exp_continue; }]);} # ***
I get the following error:
Bareword "exp_continue" not allowed while "strict subs" in use at perlscript.pl line 418.
(which is marked with ***)
Which is the -- exp_continue; }], -- line
When I take out the first sub part the error just appears in the next line containing exp_continue # ***
The print function doesn't have any effect on curing this error.
The code works when I comment out the use strict line, but this is bad and I would prefer to fix this error and keep using use strict.
My question is can any one spot any errors that might cause the code to give out the error. Is it obvious.?
Or can any one suggest a better use of the
# Wait for report to run or generate an error
part of the expect module
When I use diagnostics I get some more information
Uncaught exception from user code:
Bareword "exp_continue" not allowed while "strict subs" in use at perlscript.pl line 421.
perlscript.pl had compilation errors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: expect module: exp_continue error
by Happy-the-monk (Canon) on Jul 13, 2004 at 11:18 UTC | |
|
Re: expect module: exp_continue error
by Paulster2 (Priest) on Jul 13, 2004 at 11:11 UTC | |
|
Re: expect module: exp_continue error
by chime (Friar) on Jul 13, 2004 at 11:23 UTC | |
by Anonymous Monk on Aug 08, 2007 at 18:40 UTC |