http://www.perlmonks.org?node_id=478140


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

sysseek() does not work on a FIFO it seems.
would it be a solution to reopen the FIFO before the select statement ?
it works, but i dont think that is the proper way....
use strict; use POSIX qw(mkfifo); use Fcntl qw(O_RDONLY O_NONBLOCK SEEK_SET); use IO::Handle; my $fifofile = "fifo"; my $inputbuf; unlink($fifofile); mkfifo($fifofile, 0666) or die (' can\'t create FIFO:'.$fifofile); while (1){ sysopen(FIFOFD, $fifofile, O_RDONLY | O_NONBLOCK ) or die ("can\'t + read FIFO:'.$fifofile"); my $rin =''; vec($rin,fileno(FIFOFD),1)=1; select( $rin, undef, undef, undef ); print "select returning\n"; my $fromfifo; while ( sysread(FIFOFD, $fromfifo, 1) == 1 ){ $inputbuf .= $fromfifo ; } my $command; my $index; while ( $index = index($inputbuf,"\n" )+1 ){ my $command = substr($inputbuf,0,$index,""); if ( defined ($command) ) { print $command; } } }