in reply to Tasking children from a single pipe

In order to effeciently use all the children, I want each child to only take one "task" from the pipe, leaving the next child to pickup the next "task". The work data is separated by a newline, and each child reads up to the first newline it encounters.

...

What would you do?

I would write a magazine article about it, probably.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on Re: Tasking children from a single pipe

Replies are listed 'Best First'.
Re^2: Tasking children from a single pipe
by vancetech (Beadle) on Mar 15, 2006 at 22:07 UTC
    I thought that managing a pipe for each child would be unruly, but your example provided me with the information I needed. Specifically maintaining a hash of pipes associated to each child PID was what I was looking for. IO::Pipe provided the handle reference I needed to do that.

    How could I have taken a reference to a FILEHANDLE like:
    pipe( READER, WRITER ); $pipes{$pid} = [\*READER, \*WRITER];
    Would that be the same thing as using IO::Pipe?