Hi,
thanks for the response,

thats right , system function will block till the command is complete

foreach $filename (@FILES) {
$retval = system("perl sample.pl $filename");
if ($retval ==0 ) { print "success with $filename, output shd
be $expectedname.zip in the current working dir.";}
}

$retval has return status for system command , but if the perl runs with
error for the file , will it reflect in $retval.?
and
is this the efficient way if the system command blocks for 10-15 mins?

Thanks,


On 3/15/06, Joshua Colson <[EMAIL PROTECTED]> wrote:
>
> The system function will block until processing is complete.
>
> On Wed, 2006-03-15 at 10:21 -0800, Sonika Sachdeva wrote:
> > Hi,
> >
> > I need to run " perl sample.pl $filename " from a perl program . The
> output
> > is a zip file which needs to be processed further.
> > Now the issues are:
> >
> > 1. this execution takes around 10-15 mins and i need to wait for it to
> > complete bfore i start the next execution with a new filename.
> > 2. get hold of the output zip file for processing
> >
> > I have 2 options
> > 1.
> > $retval = system("perl sample.pl $filename");
> > I would need a while loop to poll the "$?" for the complete execution of
> the
> > system command.
> >
> > 2.
> >
> > if (!defined($kidpid = fork())) {
> >     # fork returned undef, so failed
> >     die "cannot fork: $!";
> > } elsif ($kidpid == 0) {
> >                 # fork returned 0, so this branch is the child
> >     exec("perl sample.pl $filename");
> >                 # if the exec fails, fall through to the next statement
> >     die "can't exec command: $!";
> > } else {
> >                 # fork returned neither 0 nor undef,
> >                 # so this branch is the parent
> >     waitpid($kidpid, 0);
> > }
> >
> > which one can I use ? How to get the output .zip file for processing (
> > this perl program is executed on a windows system)
> >
> > Thanks,
> >
> >
> >
>
>
> !DSPAM:22,44185d75317231544624326!
>
>
>

Reply via email to