summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-07-19 22:15:43 +0000
committerNicholas Clark <nick@ccl4.org>2005-07-19 22:15:43 +0000
commit42bf33b5fc7ae0d4251da5bee07d8ce557915334 (patch)
tree54e326d3bcf60f608610d7fa340d3902f66139f0
parentd3ac73385d36ed84fb21dee9d9f2f3c77e7059a2 (diff)
downloadperl-42bf33b5fc7ae0d4251da5bee07d8ce557915334.tar.gz
C<use Foo;> inside Foo.pm considered a "bad thing"
(Certainly where there is AUTOLOADing and XS) Hopefully *this* fixes the POSIX breakage. p4raw-id: //depot/perl@25190
-rw-r--r--ext/POSIX/POSIX.pm19
1 files changed, 11 insertions, 8 deletions
diff --git a/ext/POSIX/POSIX.pm b/ext/POSIX/POSIX.pm
index 8e58c04054..079861afa8 100644
--- a/ext/POSIX/POSIX.pm
+++ b/ext/POSIX/POSIX.pm
@@ -63,17 +63,20 @@ use strict;
use Tie::Hash;
use base qw(Tie::StdHash);
-use POSIX qw(sigaction SIGRTMIN SIGRTMAX SA_RESTART);
-
use vars qw($SIGACTION_FLAGS);
$SIGACTION_FLAGS = 0;
-my $SIGRTMIN = &SIGRTMIN;
-my $SIGRTMAX = &SIGRTMAX;
-my $sigrtn = $SIGRTMAX - $SIGRTMIN;
+my ($SIGRTMIN, $SIGRTMAX, $sigrtn);
+
+sub _init {
+ $SIGRTMIN = &POSIX::SIGRTMIN;
+ $SIGRTMAX = &POSIX::SIGRTMAX;
+ $sigrtn = $SIGRTMAX - $SIGRTMIN;
+}
sub _croak {
+ &_init unless defined $sigrtn;
die "POSIX::SigRt not available" unless defined $sigrtn && $sigrtn > 0;
}
@@ -105,17 +108,17 @@ sub new {
my $sigact = POSIX::SigAction->new($handler,
$sigset,
$flags);
- sigaction($rtsig, $sigact);
+ POSIX::sigaction($rtsig, $sigact);
}
sub EXISTS { &_exist }
sub FETCH { my $rtsig = &_check;
my $oa = POSIX::SigAction->new();
- sigaction($rtsig, undef, $oa);
+ POSIX::sigaction($rtsig, undef, $oa);
return $oa->{HANDLER} }
sub STORE { my $rtsig = &_check; new($rtsig, $_[2], $SIGACTION_FLAGS) }
sub DELETE { delete $SIG{ &_check } }
-sub CLEAR { &_exist; delete @SIG{ SIGRTMIN .. SIGRTMAX } }
+sub CLEAR { &_exist; delete @SIG{ &POSIX::SIGRTMIN .. &POSIX::SIGRTMAX } }
sub SCALAR { &_croak; $sigrtn + 1 }
tie %POSIX::SIGRT, 'POSIX::SigRt';