B
Brian T Glenn
I am attempting to use IO::Select to poll a FIFO created by mkfifo. The
FIFO has absolutely no writers attached to it. The following is the
code:
$fifo = IO::File->new();
fatal("Could not open FIFO for reading: $!") unless $fifo->open($cfg{'General'}{'FIFO'});
# Prepare to enter the main loop
$loop = IO::Select->new($fifo);
do_log(1,"Entering processing loop\n");
while(1) {
@tasklist = $loop->can_read();
foreach my $fh (@tasklist) {
if ($fh == $fifo) {
do_log(5,"Received a message from the FIFO");
}
else {
do_log(5,"Receiving a message from another source");
}
}
}
__END__
Shouldn't the can_read() method block until data appears on the FIFO? I
have tried it both with and without a timeout, and the process spins
indefinitely, filling the syslog with "Received a message from the FIFO".
I never receive the message "Receiving a message from another source" in
the syslog. There are also no other filehandles attached to the
IO::Select object.
Thanks in advance,
FIFO has absolutely no writers attached to it. The following is the
code:
$fifo = IO::File->new();
fatal("Could not open FIFO for reading: $!") unless $fifo->open($cfg{'General'}{'FIFO'});
# Prepare to enter the main loop
$loop = IO::Select->new($fifo);
do_log(1,"Entering processing loop\n");
while(1) {
@tasklist = $loop->can_read();
foreach my $fh (@tasklist) {
if ($fh == $fifo) {
do_log(5,"Received a message from the FIFO");
}
else {
do_log(5,"Receiving a message from another source");
}
}
}
__END__
Shouldn't the can_read() method block until data appears on the FIFO? I
have tried it both with and without a timeout, and the process spins
indefinitely, filling the syslog with "Received a message from the FIFO".
I never receive the message "Receiving a message from another source" in
the syslog. There are also no other filehandles attached to the
IO::Select object.
Thanks in advance,