/usr/share/perl5/Signal/Pending.pm is in libsignal-mask-perl 0.008-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | package Signal::Pending;
$Signal::Pending::VERSION = '0.008';
use strict;
use warnings FATAL => 'all';
use Config;
use POSIX qw/sigpending/;
use IPC::Signal qw/sig_num sig_name/;
use Carp qw/croak/;
my $sig_max = $Config{sig_count} - 1;
tie %Signal::Pending, __PACKAGE__;
sub TIEHASH {
my $class = shift;
my $self = { iterator => 1, };
return bless $self, $class;
}
sub _get_status {
my ($self, $num) = @_;
my $mask = POSIX::SigSet->new;
sigpending($mask);
return $mask->ismember($num);
}
sub FETCH {
my ($self, $key) = @_;
return $self->_get_status(sig_num($key));
}
sub STORE {
my ($self, $key, $value) = @_;
croak 'Can\'t assign to %Signal::Pending';
}
sub DELETE {
my ($self, $key) = @_;
croak 'Can\'t delete from %Signal::Pending';
}
sub CLEAR {
my ($self) = @_;
croak 'Can\'t clear %Signal::Pending';
}
sub EXISTS {
my ($self, $key) = @_;
return defined sig_num($key);
}
sub FIRSTKEY {
my $self = shift;
$self->{iterator} = 1;
return $self->NEXTKEY;
}
sub NEXTKEY {
my $self = shift;
if ($self->{iterator} <= $sig_max) {
my $num = $self->{iterator}++;
return wantarray ? (sig_name($num) => $self->_get_status($num)) : sig_name($num);
}
else {
return;
}
}
sub SCALAR {
my $self = shift;
my $mask = POSIX::SigSet->new;
sigpending($mask);
return scalar grep { $mask->ismember($_) } 1 .. $sig_max;
}
sub UNTIE {
}
sub DESTROY {
}
1; # End of Signal::Mask
# ABSTRACT: Signal pending status made easy
__END__
=pod
=encoding UTF-8
=head1 NAME
Signal::Pending - Signal pending status made easy
=head1 VERSION
version 0.008
=head1 SYNOPSIS
use Signal::Mask;
use Signal::Pending;
{
local $Signal::Mask{INT} = 1;
do {
something();
} while (not $Signal::Pending{INT})
}
#signal delivery gets postponed until now
=head1 DESCRIPTION
Signal::Pending is an abstraction around your process'/thread's pending signals. It can be used in combination with signal masks to handle signals in a controlled manner. The set of pending signals is available as the global hash %Signal::Pending.
=for Pod::Coverage SCALAR
=head1 AUTHOR
Leon Timmermans <fawaka@gmail.com>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Leon Timmermans.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|