develooper Front page | perl.perl5.changes | Postings from November 2010

[perl.git] branch blead, updated. v5.13.7-185-gf5122db

From:
Dave Mitchell
Date:
November 29, 2010 03:25
Subject:
[perl.git] branch blead, updated. v5.13.7-185-gf5122db
Message ID:
E1PN1qp-0004PP-9l@camel.ams6.corp.booking.com
In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/f5122dbf0e65ac96618bf95b58dbfac3cfb31c75?hp=75bc03b37d4cda9b1f2c599806c7d977157d9df5>

- Log -----------------------------------------------------------------
commit f5122dbf0e65ac96618bf95b58dbfac3cfb31c75
Author: David Mitchell <davem@iabyn.com>
Date:   Mon Nov 29 11:23:28 2010 +0000

    document why eintr.t needs to be skipped on Win32

M	t/io/eintr.t

commit 9eed50dc853be0183bf92923847963d81c3f8f51
Author: David Mitchell <davem@iabyn.com>
Date:   Mon Nov 29 10:36:19 2010 +0000

    in perlipc, 'named pipes' was in signals section
    
    Move the '=head1 Named Pipes' section down so that it's no longer nested,
    cuckoo-like, in the middle of the '=head1 Signals' section.

M	pod/perlipc.pod
-----------------------------------------------------------------------

Summary of changes:
 pod/perlipc.pod |  108 +++++++++++++++++++++++++++---------------------------
 t/io/eintr.t    |    3 ++
 2 files changed, 57 insertions(+), 54 deletions(-)

diff --git a/pod/perlipc.pod b/pod/perlipc.pod
index 5e9f408..6225d95 100644
--- a/pod/perlipc.pod
+++ b/pod/perlipc.pod
@@ -281,60 +281,6 @@ info to show that it works; it should be replaced with the real code.
   }
 
 
-=head1 Named Pipes
-
-A named pipe (often referred to as a FIFO) is an old Unix IPC
-mechanism for processes communicating on the same machine.  It works
-just like regular anonymous pipes, except that the
-processes rendezvous using a filename and need not be related.
-
-To create a named pipe, use the C<POSIX::mkfifo()> function.
-
-    use POSIX qw(mkfifo);
-    mkfifo($path, 0700)     ||  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, though.
-
-    # system return val is backwards, so && not ||
-    #
-    $ENV{PATH} .= ":/etc:/usr/etc";
-    if  (      system("mknod",  $path, "p")
-            && system("mkfifo", $path) )
-    {
-        die "mk{nod,fifo} $path failed";
-    }
-
-
-A fifo is convenient when you want to connect a process to an unrelated
-one.  When you open a fifo, the program will block until there's something
-on the other end.
-
-For example, let's say you'd like to have your F<.signature> file be a
-named pipe that has a Perl program on the other end.  Now every time any
-program (like a mailer, news reader, finger program, etc.) tries to read
-from that file, the reading program will read the new signature from your
-program.  We'll use the pipe-checking file-test operator, B<-p>, to find
-out whether anyone (or anything) has accidentally removed our fifo.
-
-    chdir();    # go home
-    my $FIFO = ".signature";
-
-    while (1) {
-        unless (-p $FIFO) {
-            unlink $FIFO;   # discard any failure, will catch later
-            require POSIX;  # delayed loading of heavy module
-            POSIX::mkfifo($FIFO, 0700)
-                                || die "can't mkfifo $FIFO: $!";
-        }
-
-        # next line blocks till there's a reader
-        open (FIFO, "> $FIFO")  || die "can't open $FIFO: $!";
-        print FIFO "John Smith (smith\@host.org)\n", `fortune -s`;
-        close(FIFO)             || die "can't close $FIFO: $!";
-        sleep 2;                # to avoid dup signals
-    }
-
 =head2 Deferred Signals (Safe Signals)
 
 Before Perl 5.7.3, installing Perl code to deal with signals exposed you to
@@ -473,6 +419,60 @@ If you want the old signal behavior back despite possible
 memory corruption, set the environment variable C<PERL_SIGNALS> to
 C<"unsafe">.  This feature first appeared in Perl 5.8.1.
 
+=head1 Named Pipes
+
+A named pipe (often referred to as a FIFO) is an old Unix IPC
+mechanism for processes communicating on the same machine.  It works
+just like regular anonymous pipes, except that the
+processes rendezvous using a filename and need not be related.
+
+To create a named pipe, use the C<POSIX::mkfifo()> function.
+
+    use POSIX qw(mkfifo);
+    mkfifo($path, 0700)     ||  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, though.
+
+    # system return val is backwards, so && not ||
+    #
+    $ENV{PATH} .= ":/etc:/usr/etc";
+    if  (      system("mknod",  $path, "p")
+            && system("mkfifo", $path) )
+    {
+        die "mk{nod,fifo} $path failed";
+    }
+
+
+A fifo is convenient when you want to connect a process to an unrelated
+one.  When you open a fifo, the program will block until there's something
+on the other end.
+
+For example, let's say you'd like to have your F<.signature> file be a
+named pipe that has a Perl program on the other end.  Now every time any
+program (like a mailer, news reader, finger program, etc.) tries to read
+from that file, the reading program will read the new signature from your
+program.  We'll use the pipe-checking file-test operator, B<-p>, to find
+out whether anyone (or anything) has accidentally removed our fifo.
+
+    chdir();    # go home
+    my $FIFO = ".signature";
+
+    while (1) {
+        unless (-p $FIFO) {
+            unlink $FIFO;   # discard any failure, will catch later
+            require POSIX;  # delayed loading of heavy module
+            POSIX::mkfifo($FIFO, 0700)
+                                || die "can't mkfifo $FIFO: $!";
+        }
+
+        # next line blocks till there's a reader
+        open (FIFO, "> $FIFO")  || die "can't open $FIFO: $!";
+        print FIFO "John Smith (smith\@host.org)\n", `fortune -s`;
+        close(FIFO)             || die "can't close $FIFO: $!";
+        sleep 2;                # to avoid dup signals
+    }
+
 =head1 Using open() for IPC
 
 Perl's basic open() statement can also be used for unidirectional
diff --git a/t/io/eintr.t b/t/io/eintr.t
index e985a83..73eddeb 100644
--- a/t/io/eintr.t
+++ b/t/io/eintr.t
@@ -40,6 +40,9 @@ if (exists $ENV{PERLIO} && $ENV{PERLIO} =~ /stdio/  ) {
 	exit 0;
 }
 
+# on Win32, alarm() won't interrupt the read/write call.
+# Similar issues with VMS.
+
 if ($^O eq 'VMS' || $^O eq 'MSWin32') {
 	skip_all('various portability issues');
 	exit 0;

--
Perl5 Master Repository



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About