in reply to Watching a named pipe
There are probably better ways, but ignoring read fails seems to work:
use 5.10.0; open my $fh, "<", "fifo" or die; while (1) { my ($line) = <$fh> or sleep 1 and redo; chomp $line; say "FIFO> $line"; }
Update: just realized it blocks until there's a writer the first time. A hack avoiding this is arranging to have one line written to the fifo and ignoring this line. Like I said before, there are probably better ways.
|
|---|