Jutu Subramanian, Srinivasan (Cognizant) wrote:

>
> Hi,
> I need to execute a perl application from one perl application.
> I should do with fork and exec. The execution of another one perl application is the 
independent
> to the parent process.So, I don't want to use wind32::CreateProcess.

Using fork() in Perl on Windows means using threads.
If you are creating another process anyway, use system() or Proc::Background.
You should create new background processes with fork() on Unix platforms.
You should create new background processes with Win32::CreateProcess() on Windows 
platforms.
Proc::Background does that for you.

> If I use the fork and exec, Need to do the process of Reaping dead children.

Proc::Background is able to reap finished child process.
Proc::Background is able to return the status of the finished child process.
Proc::Background is able to wait for child process to finish.
Proc::Background is able to kill the child process.
Proc::Background is able to check that the child process is still alive.

>
>            This method is also wait for the forked process to complete its work. So, 
the next parent
> process continues only after the child process exits.
> It overcomes the fork limitation of compiled  in limit of 64  active threads.
>
> The output for the sample code is given below.
> PARENT PROCESS=1
> filter.pl called with parameter 1
> PARENT PROCESS=2
> filter.pl called with parameter 2
> PARENT PROCESS=3
> filter.pl called with parameter 3
>
> Actually, Firt perl program(parent)  is not to wait for the another perl 
program(child) completes.
> Parent process keeps on running 24 hours. So, Child process getting accumulated in 
the process table.
> If we harvesting the dead children by the method of Reaping dead children, We would 
be getting the
> result as mentioned above. It is similar to the usage of wait at the parent process. 
Is it comfortable
> to use the reaping dead children. Kindly advice me on this and revert back for any 
clarifications.


Proc::Background allows you to create and manage multiple background processes concurrently. If you do not need to manage multiple background processes concurrently, use system(). If you only need to manage multiple background processes concurrently on Windows and want to learn more about the Win32 API use Win32::CreateProcess. If you need your code to run on both Unix and Win32 systems, use Proc::Background. If you do not want to learn about the Win32 API, or want a simpler API than Win32::CreateProcess, use Proc::Background.

> regards
> Srinivas
>

hope that helps,
rgr


_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to