[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 f94cc5b65351ee8aa9b1e11688a9242990a896e4..76dcfed734ee99b1c6787e64498d4fa5159298b2 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