On Sat, 11 Jun 2005 16:26:56 +0400, Alexey Tourbin <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> It's been discussed recently on london.pm mailing list that
> POSIX::mkfifo() is naturally better for creating named pipes
> than mknod(1).

Thanks. Since perl does neither have built-in support like mknod () or
mkdev (), I think this is a good patch. Applied as change #24807.

> --- perl-5.9.3.24797/pod/perlipc.pod- 2005-06-03 08:31:04 +0000
> +++ perl-5.9.3.24797/pod/perlipc.pod  2005-06-10 21:41:46 +0000
> @@ -246,7 +246,12 @@
>  just like a regular, connected anonymous pipes, except that the
>  processes rendezvous using a filename and don't have to be related.
>  
> -To create a named pipe, use the Unix command mknod(1) or on some
> +To create a named pipe, use the C<POSIX::mkfifo()> function.
> +
> +    use POSIX qw(mkfifo);
> +    mkfifo($path, 0700) or die "mkfifo $path failed: $!";
> +
> +You can also use the Unix command mknod(1) or on some
>  systems, mkfifo(1).  These may not be in your normal path.
>  
>      # system return val is backwards, so && not ||
> @@ -272,13 +277,13 @@
>  
>      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: $!";
> +         require POSIX;
> +         POSIX::mkfifo($FIFO, 0700)
> +             or die "can't mkfifo $FIFO: $!";
>       }
>  
>       # next line blocks until there's a reader
> End of patch


-- 
H.Merijn Brand        Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using Perl 5.6.2, 5.8.0, 5.8.5, & 5.9.2  on HP-UX 10.20, 11.00 & 11.11,
 AIX 4.3 & 5.2, SuSE 9.2 & 9.3, and Cygwin. http://www.cmve.net/~merijn
Smoking perl: http://www.test-smoke.org,    perl QA: http://qa.perl.org
 reports  to: [EMAIL PROTECTED],                perl-qa@perl.org

Reply via email to