package Pexitstat; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(exitstatus); our $WEXITSTATUS = sub { $_[0] >> 8 }; sub exitstatus { &$WEXITSTATUS($_[0]); } if (eval "use POSIX; 1") { local $! = 0; my $EAGAIN = POSIX::constant("EAGAIN", 0); my $val = POSIX::constant("WEXITSTATUS", 0); if ($! == $EAGAIN) { $WEXITSTATUS = sub { POSIX::constant("WEXITSTATUS", $_[0]) }; } } 1; #### package Pexitstat; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(exitstatus); sub exitstatus { $_[0] >> 8; } if (eval "use POSIX; 1") { local $! = 0; my $EAGAIN = POSIX::constant("EAGAIN", 0); my $val = POSIX::constant("WEXITSTATUS", 0); if ($! == $EAGAIN) { *exitstatus = sub { POSIX::constant("WEXITSTATUS", $_[0]) }; } } 1;