in reply to reading from a named pipe
I don't know why it works on one but not the other, but I can see a possible problem if two messages arrive in quick succession
You read only a single line from the pipe on each open, but you're using buffered input, so it's possible if two messages arrive in quick succession that for the <$fifo> PerlIO reads both lines into the buffer, and readline() (aka <>) returns the first of those two lines
You then re-open the pipe each time around the loop and discard the buffered line.
Given what you've shown I don't see why you don't just have a classic while (my $line = <$fifo>) { ... } loop.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: reading from a named pipe
by skendric (Novice) on Jun 10, 2024 at 12:46 UTC |