Perl unable to open named pipe
Da Rock
freebsd-questions at herveybayaustralia.com.au
Mon Dec 16 20:30:24 UTC 2013
Little left field, but I cannot seem to make this work and it would
appear to be peculiar to FreeBSD (although I have no means to test this
on another system atm); I'm trying to write a small script of a larger
project that uses named pipes for IPC and perl strangely cannot open them.
This basically what my script is doing - it is pretty much this short:
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
use POSIX qw(mkfifo);
if (!open(HANDLE, "<", FIFO)) {
if (mkfifo(FIFO)) {
print "FIFO created\n";
open(HANDLE, "<", FIFO);
}
else {
die "couldn't create FIFO";
}
else {
}
The script literally hangs when open is called. Diagnostics gives no
clue to what could be the issue. I've tried unless instead of if (so die
can be called and an error can be printed). And I've put messages in to
see where it gets to in the script, and that confirms the position of
the stall. I've also tried on an ordinary text file - it works, but just
not FIFO!
Any clues?
Cheers
More information about the freebsd-questions
mailing list