Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Dec 2013 06:23:01 +1000
From:      Da Rock <freebsd-questions@herveybayaustralia.com.au>
To:        freebsd-questions@freebsd.org
Subject:   Perl unable to open named pipe
Message-ID:  <52AF6125.3010500@herveybayaustralia.com.au>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52AF6125.3010500>