Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
When I open FIFO with "<" and omit the print "START", loop starts running only after printing something from external program to the FIFO. But I want the loop to run immediately. Thanks, A.my $s = IO::Select->new; my $dxc_fifo="/tmp/dxc_fifo"; my $fifo_str; open my $fifo_fh, "+>", "$dxc_fifo" or die "could not open $dxc_fifo\n"; $s->add($fifo_fh); print $fifo_fh "START\n"; my $i=0; while (1) { sleep 1; $i++; print "loop #$i \n"; my @files = $s->can_read(.25); if (@files) { for my $fh (@files) { my $line = <$fh>; if ($line) { print "from pipe: $line"; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: First SELECT of FIFO still blocked ?
by Corion (Patriarch) on Dec 16, 2015 at 13:31 UTC | |
|
Re: First SELECT of FIFO still blocked ?
by Apero (Scribe) on Dec 16, 2015 at 22:05 UTC | |
by Aquarius (Initiate) on Dec 17, 2015 at 10:29 UTC |