in reply to Re^3: manage file in parallel
in thread manage file in parallel

Hi,
I had tried the following example, but it look that the program is not completed (runs in infinite loop?!!) Any idea ? or other example that i can use for running a program that every time any other program tries to read/write from that file the reading/writing program will block until the first will complete ?
chdir; # go home $FIFO = '.signature'; $ENV{PATH} .= ":/etc:/usr/games"; while (1) { unless (-p $FIFO) { unlink $FIFO; system('mknod', $FIFO, 'p') && die "can't mknod $FIFO: $!"; } # next line blocks until there's a reader open (FIFO, "> $FIFO") || die "can't write $FIFO: $!"; print FIFO "John Smith (smith\@host.org\n"; close FIFO; sleep 2; # to avoid dup signals }

Formatting added by holli