| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Sys::Sig; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
3709
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
71
|
|
|
4
|
2
|
|
|
2
|
|
12
|
use Config; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
76
|
|
|
5
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
180
|
|
|
6
|
2
|
|
|
2
|
|
11
|
use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS); |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
729
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION = do { my @r = (q$Revision: 0.05 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
@EXPORT_OK = split(/\s+/,$Config{sig_name}); |
|
15
|
|
|
|
|
|
|
%EXPORT_TAGS = ( |
|
16
|
|
|
|
|
|
|
all => [@EXPORT_OK], |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my %signal; |
|
20
|
|
|
|
|
|
|
@signal{@EXPORT_OK} = split(/\s+/,$Config{sig_num}); |
|
21
|
|
|
|
|
|
|
|
|
22
|
0
|
|
|
0
|
|
0
|
sub DESTROY {}; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
25
|
2
|
|
|
2
|
|
11
|
no strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
3063
|
|
|
26
|
27
|
|
|
27
|
|
9868
|
($_ = uc $AUTOLOAD) =~ /[^:]+$/; |
|
27
|
27
|
100
|
|
|
|
233
|
return $signal{$&} if exists $signal{$&}; |
|
28
|
2
|
|
|
|
|
350
|
croak "your system has not defined SIGNAL '$&'"; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub new { |
|
32
|
1
|
|
|
1
|
0
|
168
|
my ($proto) = @_; |
|
33
|
1
|
|
33
|
|
|
10
|
my $class = ref($proto) || $proto; |
|
34
|
1
|
|
|
|
|
2
|
my $self = \$class; |
|
35
|
1
|
|
|
|
|
4
|
bless ($self, $class); |
|
36
|
1
|
|
|
|
|
3
|
return $self; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub print { |
|
40
|
0
|
|
0
|
0
|
0
|
|
local *FH = shift || 'STDOUT'; |
|
41
|
0
|
|
|
|
|
|
my $fh = *FH; |
|
42
|
0
|
|
|
|
|
|
foreach (sort keys %signal) { |
|
43
|
0
|
|
|
|
|
|
print $fh $_, "\t=> $signal{$_}\n"; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub printN { |
|
48
|
0
|
|
0
|
0
|
0
|
|
local *FH = shift || 'STDOUT'; |
|
49
|
0
|
|
|
|
|
|
my $fh = *FH; |
|
50
|
0
|
0
|
|
|
|
|
foreach(sort { |
|
|
0
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$signal{$a} <=> $signal{$b} |
|
52
|
|
|
|
|
|
|
|| |
|
53
|
|
|
|
|
|
|
$a cmp $b } keys %signal) { |
|
54
|
0
|
|
|
|
|
|
print $fh $_, "\t=> $signal{$_}\n"; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Sys::Sig -- return signal constants for this host |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 AS METHODS |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
use Sys::Sig; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $TERM = Sys::Sig->TERM; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
kill $TERM, $pid; |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
or |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $Sig = new Sys::Sig; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $TERM = $Sig->TERM; |
|
78
|
|
|
|
|
|
|
... |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
NOTE: the signal name is not case sensitive. |
|
81
|
|
|
|
|
|
|
The following will work just as well for METHODS ONLY: |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
my $TERM = $Sig->TeRm; |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 AS FUNCTIONS |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
use Sys::Sig qw(:all) |
|
88
|
|
|
|
|
|
|
use Sys::Sig qw( |
|
89
|
|
|
|
|
|
|
HUP |
|
90
|
|
|
|
|
|
|
TERM |
|
91
|
|
|
|
|
|
|
etc... |
|
92
|
|
|
|
|
|
|
); |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Use this syntax with care. Depending on the usage, perl may not interpret |
|
95
|
|
|
|
|
|
|
the bare word correctly. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
i.e. my $term = TERM; |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Better: |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
my $term = &TERM; |
|
102
|
|
|
|
|
|
|
my $term = TERM(); |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
or, without the import |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
my $term = &Sys::Sig::TERM; |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
or, case insensitive for full package function call |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $term = &Sys::Sig::term; |
|
111
|
|
|
|
|
|
|
my $term = Sys::Sig::term(); |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 PRINT SIGNALS VALUES |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Print an alphabetical list of all signals to the FILEHANDLE or |
|
116
|
|
|
|
|
|
|
STDOUT if no filehandle is specified. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Sys::Sig::print(*FILEHANDLE); |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Print a numeric sorted list of all signals to the FILEHANDLE or |
|
121
|
|
|
|
|
|
|
STDOUT if no filehandle is specified. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Sys::Sig::printN(*FILEHANDLE); |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 AUTHOR |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Michael Robinton |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Copyright 2006-2014, Michael Robinton |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
|
134
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
|
135
|
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or |
|
136
|
|
|
|
|
|
|
(at your option) any later version. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
|
139
|
|
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
140
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
141
|
|
|
|
|
|
|
GNU General Public License for more details. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
|
144
|
|
|
|
|
|
|
along with this program; if not, write to the Free Software |
|
145
|
|
|
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
1; |