Perl fork or system



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,


Relevant Pages

  • Re: Problem in Executing system command in a forking server
    ... >> I am trying to store the return value of system command after execution ... >> should return -1 only in case of failure. ... process fails to "wait" on its child processes (i.e. child ...
    (comp.lang.perl.misc)
  • Re: Perl fork or system
    ... I would need a while loop to poll the "$?" ... for the complete execution of the ... system command. ...
    (perl.beginners)
  • Re: Forcefully aborting asychronous call.
    ... In method i am calling set method at the end of whole procedure. ... But what i want is if process is not completed say withing 2 mins then ... Means like if we call thread.abort it stop execution of thread, ... Developers for exciting positions in medical product ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Timer with variable delay
    ... if the last execution of this scheduled task returned false, the delay ... should be 10 mins. ...
    (comp.lang.java.programmer)
  • Re: Remove from Cache
    ... Yes but my question is that at the first time when procedure take 2 mins ... > was another process keeping the disks/CPUs busy the first execution. ... but CPU is more telling as high ...
    (microsoft.public.sqlserver.clients)