How to manage multiple subprocesses in Perl?

I have a Perl program that needs to run about half a dozen programs at the same time in the background and wait for them to finish before continuing. It is also very important that the release status of each of them can be fixed.

Is there a common idiom for this in Perl? I'm currently thinking about using threads.

+5
source share
2 answers

Do not use streams. Thread suck. The correct way consists in forkseveral processes and waitfor their completion. If you use waitor waitpid, the exit status of the process in question will be available at $?.

. perldocs fork, wait waitpid, SO-.

, , Parallel::ForkManager.

+8

fork + exec ( UNIX )

fork , , exec , - . , / .

- , cpan POE, .

:

Google "perl cookbook forking server" - , .

+2

All Articles