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
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: select($rin,undef,undef,undef) only blocking once
by rabbit7 (Initiate) on Jul 26, 2005 at 13:43 UTC | |
by Tanalis (Curate) on Jul 26, 2005 at 13:49 UTC | |
by rabbit7 (Initiate) on Jul 27, 2005 at 11:13 UTC |
In Section
Seekers of Perl Wisdom