Perl fork or system
- From: replysonika@xxxxxxxxx (Sonika Sachdeva)
- Date: Wed, 15 Mar 2006 10:21:46 -0800
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,
- Follow-Ups:
- Re: Perl fork or system
- From: Tom Phoenix
- Re: Perl fork or system
- From: JupiterHost.Net
- Re: Perl fork or system
- Prev by Date: Re: DBI/SQL question
- Next by Date: Re: Line Swap
- Previous by thread: DBI/SQL question
- Next by thread: Re: Perl fork or system
- Index(es):
Relevant Pages
|