in reply to open ($FH,"<named pipe") blocking

Change your open to open(IN_FH,"$INFILE|"). That tells perl to treat the filehandle as a pipe. UPDATE: Sorry, this is incorrect. see replies.

Replies are listed 'Best First'.
Re^2: open ($FH,"<named pipe") blocking
by Fletch (Bishop) on May 12, 2005 at 18:26 UTC

    I think you misunderstood what they're asking. They're trying to open a named pipe, which is a special pipe which lives in the filesystem. When you try and open it the open(2) system call underneath will block if there's no writer on the other end.

    They need to look at the O_NONBLOCK flag for sysopen rather than using open.

    Update: Excepting of course that that will just make the sysopen fail with a return code of EAGAIN (I believe). That's just the way named pipes work; the call blocks until there's something on the other end.

      You nailed it. I knew it was something simple, but it has been soooooo long since I had to use pipe for anything I forgot about sysopen. Thanks.
Re^2: open ($FH,"<named pipe") blocking
by ikegami (Patriarch) on May 12, 2005 at 18:24 UTC

    No. That tells perlto execute the command stored in $INFILE and open IN_FH as a pipe to the command's output. That doesn't tell perl to open the named pipe whose name is in $INFILE.

Re^2: open ($FH,"<named pipe") blocking
by gnu@perl (Pilgrim) on May 12, 2005 at 18:24 UTC
    That actually tells perl to exec the thing in $INFILE and read from it as if it were a pipe. like if I were to do:
    $INFILE="/usr/bin/cat /var/adm/messages"; open($FH,"$INFILE|")