in reply to Re^3: example for ipc::open3
in thread example for ipc::open3

Hello Zentara,

I am trying to run some processes simulataneously. When those processes are running simulataneously, I want to see the output of each process and as soon as I find a word I am looking for e.g. error, then I would like to immediatly stop all the processes. I am trying to implement using open3. Could you please advice how I could implement this?

Thanks.

Replies are listed 'Best First'.
Re^5: example for ipc::open3
by zentara (Cardinal) on Jan 08, 2005 at 12:11 UTC
    Uh, sounds like work. :-) I would use the first example I gave you, which uses IO::Select to read the filehandles. Open each of your processes with IPC and add the \*READ filehandle to select, and store the $pid. I would put them in a hash for easy reference. When you read the output, run it through a regex, and when you find the word, kill all $pids. You probably would find an example of doing what you want with the Parallel::ForkManager module, which may be better suited for this kind of operation.

    I'm not really a human, but I play one on earth. flash japh