in reply to POE Examples

Depending on the amount of error checking you need, runN might already be enough to run multiple processes in parallel. Alternatively, have a look at Parallel::ForkManager.

If you are on Windows, using fork() gets a bit hairier. I would use threads together with system() to do the processing mostly in the children as spawned by system(). For managing / limiting the children, look at Re^3: Multi-threads newbie questions, which should be a good skeleton on how to use a set of worker threads working on a (larger) set of tasks.

Replies are listed 'Best First'.
Re^2: POE Examples
by SimonPratt (Friar) on Jul 14, 2014 at 14:08 UTC

    I agree with Corion, although if you are running on Windows, I strongly suggest avoiding Parallel::ForkManager and instead use threads, along with Thread::Queue to manage your inputs and outputs.

    The way I have tackled this type of scenario is to have one queue with all the input files listed, a set of processing threads, which pick from that queue, process the files and "print" the output to another queue. A final thread is responsible for picking from the output queue and writing directly to file without performing any processing. Its a simple model that re-uses existing threads, reducing the overhead of threading your app.

      Thanks.I have used threads and It's working fine.