I still favour a blocking read over blocking using select, though - you're using two system calls (which are relatively expensive) to do the job of one (unless there's something I'm missing).
Paraphrasing the Cookbook a little, replacing your loop with
would seem to work as expected.for( ;; ) { open FIFO; "<", $fifofile or die $!; my $buf = <FIFO>; # blocks next unless defined $buf; chomp $buf; print $buf; close FIFO; }
Just as a final point, I'm not 100% sure what you're trying to achieve with your calls to index and substr - all you seem to be doing there is stripping the newline, which you can achieve using chomp.
Hope that helps.
-- Foxcub
#include www.liquidfusion.org.uk
In reply to Re^3: select($rin,undef,undef,undef) only blocking once
by Tanalis
in thread select($rin,undef,undef,undef) only blocking once
by rabbit7
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |