http://qs1969.pair.com?node_id=478151


in reply to Re^2: select($rin,undef,undef,undef) only blocking once
in thread select($rin,undef,undef,undef) only blocking once

It'd seem to be.

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

for( ;; ) { open FIFO; "<", $fifofile or die $!; my $buf = <FIFO>; # blocks next unless defined $buf; chomp $buf; print $buf; close FIFO; }
would seem to work as expected.

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.