This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[patch pod/perlipc] use POSIX; w/o () is a bad idea
authorStas Bekman <stas@stason.org>
Wed, 24 Nov 2004 11:25:14 +0000 (06:25 -0500)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Wed, 24 Nov 2004 16:07:38 +0000 (16:07 +0000)
Message-ID: <41A4B5EA.3020804@stason.org>

p4raw-id: //depot/perl@23533

pod/perlipc.pod

index f94cc5b..76dcfed 100644 (file)
@@ -355,11 +355,16 @@ with your timeouts.  If you are having problems with such functions,
 you can try using the POSIX sigaction() function, which bypasses the
 Perl safe signals (note that this means subjecting yourself to
 possible memory corruption, as described above).  Instead of setting
-C<$SIG{ALRM}> try something like the following:
+C<$SIG{ALRM}>:
 
-    use POSIX;
-    sigaction SIGALRM, new POSIX::SigAction sub { die "alarm\n" }
-        or die "Error setting SIGALRM handler: $!\n";
+   local $SIG{ALRM} = sub { die "alarm" };
+
+try something like the following:
+
+    use POSIX qw(SIGALRM);
+    POSIX::sigaction(SIGALRM,
+                     POSIX::SigAction->new(sub { die "alarm" }))
+          or die "Error setting SIGALRM handler: $!\n";
 
 =item Restartable system calls