From: Stas Bekman Date: Wed, 24 Nov 2004 11:25:14 +0000 (-0500) Subject: [patch pod/perlipc] use POSIX; w/o () is a bad idea X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e399c6ae35b89e9cc7cbf04b75c6458d318a75d0;p=p5sagit%2Fp5-mst-13.2.git [patch pod/perlipc] use POSIX; w/o () is a bad idea Message-ID: <41A4B5EA.3020804@stason.org> p4raw-id: //depot/perl@23533 --- diff --git a/pod/perlipc.pod b/pod/perlipc.pod index f94cc5b..76dcfed 100644 --- a/pod/perlipc.pod +++ b/pod/perlipc.pod @@ -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