in reply to Re^2: IPC via named pipes, losing some messages
in thread IPC via named pipes, losing some messages

I think you're better off using a socket based approach. Then you'll have a separate file handle for every connection. By closing and re-opening the pipe you introduce a race condition and (at the very least) run the risk of causing SIGPIPE signals to be sent to the client processes. (And maybe this is what is happening since your clients are logging the message being sent before writing it to the pipe.)

That said, does this work for you?

open FH, "<pipe" or die "open failed; $!\n"; my $buf; while (1) { my $nr = sysread(FH, $buf, 1024, length($buf)); while ($buf =~ s/^(.*?)\n//) { process_line($1); } sleep(1); } close(FH);
I haven't yet found out how to make the sysread call blocking, but if I do I'll let you know.