in reply to Problem with FIFO

When the last writer on a fifo closes its end, the reader will see end of file. Since you are opening and closing the fifo for each line, the reader is only getting one line before seeing EOF.

Do something like this:

use FileHandle; ... open(FIFO, ">", "named.pipe") or die "open failed; $!"; FIFO->autoflush(1); ... for $file (@list) { print FIFO $file, "\n"; sleep(...); } close(FIFO);
Or, have your reader program immediately re-open its end after it detects EOF.

Replies are listed 'Best First'.
Re^2: Problem with FIFO
by pktrain (Acolyte) on Jul 05, 2008 at 16:03 UTC
    Yes! I made the changes you suggested and the script now works great. Many thanks... :)