in reply to Using Perl to launch another Perl script and generate error log if it fails
replace the warns with any error handling youd want to do.# untested @perlscripts = qw[1.pl 2.pl 3.pl]; foreach my $perlscript (@perlscripts) { system($perlscript); if($? == -1) { warn "Couldn't start $perlscript: $!"; } elsif($? != 0) { warn "Perl script $perlscript exited with: ". $? >> 8 } }
and replace the warn's withopen(<FH>, ">logfile.txt") || die "Doh: $!";
print FH "warning message";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Using Perl to launch another Perl script and generate error log if it fails
by Tomw72us (Initiate) on Mar 26, 2004 at 00:21 UTC | |
by TilRMan (Friar) on Mar 26, 2004 at 02:04 UTC |