line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: Signal.pm,v 1.4 1998-10-27 16:16:13-05 roderick Exp $ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (c) 1997 Roderick Schertler. All rights reserved. This |
4
|
|
|
|
|
|
|
# program is free software; you can redistribute it and/or modify it |
5
|
|
|
|
|
|
|
# under the same terms as Perl itself. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package IPC::Signal; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
72394
|
use 5.003_94; # __PACKAGE__ |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
46
|
|
10
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
11
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION @ISA @EXPORT_OK $AUTOLOAD %Sig_num @Sig_name); |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
606
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
require Exporter; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$VERSION = '1.00'; |
16
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
17
|
|
|
|
|
|
|
@EXPORT_OK = qw(sig_num sig_name sig_translate_setup %Sig_num @Sig_name); |
18
|
|
|
|
|
|
|
%Sig_num = (); |
19
|
|
|
|
|
|
|
@Sig_name = (); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub sig_num ($); |
22
|
|
|
|
|
|
|
sub sig_name ($); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub sig_translate_setup () { |
25
|
1
|
50
|
33
|
1
|
1
|
8
|
return if %Sig_num && @Sig_name; |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
14
|
require Config; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# In 5.005 the sig_num entries are comma separated and there's a |
30
|
|
|
|
|
|
|
# trailing 0. |
31
|
1
|
|
|
|
|
1315
|
my $num = $Config::Config{'sig_num'}; |
32
|
1
|
50
|
|
|
|
4222
|
if ($num =~ s/,//g) { |
33
|
0
|
|
|
|
|
0
|
$num =~ s/\s+0$//; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
10
|
my @name = split ' ', $Config::Config{'sig_name'}; |
37
|
1
|
|
|
|
|
92
|
my @num = split ' ', $num; |
38
|
|
|
|
|
|
|
|
39
|
1
|
50
|
|
|
|
8
|
@name or die 'No signals defined'; |
40
|
1
|
50
|
|
|
|
5
|
@name == @num or die 'Signal name/number mismatch'; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
69
|
@Sig_num{@name} = @num; |
43
|
1
|
50
|
|
|
|
7
|
keys %Sig_num == @name or die 'Duplicate signal names present'; |
44
|
1
|
|
|
|
|
3
|
for (@name) { |
45
|
69
|
100
|
|
|
|
217
|
$Sig_name[$Sig_num{$_}] = $_ |
46
|
|
|
|
|
|
|
unless defined $Sig_name[$Sig_num{$_}]; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# This autoload routine just is just for sig_num() and sig_name(). It |
51
|
|
|
|
|
|
|
# calls sig_translate_setup() and then snaps the real function definitions |
52
|
|
|
|
|
|
|
# into place. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub AUTOLOAD { |
55
|
1
|
50
|
33
|
1
|
|
218
|
if ($AUTOLOAD ne __PACKAGE__ . '::sig_num' |
56
|
|
|
|
|
|
|
&& $AUTOLOAD ne __PACKAGE__ . '::sig_name') { |
57
|
0
|
|
|
|
|
0
|
require Carp; |
58
|
0
|
|
|
|
|
0
|
Carp::croak("Undefined subroutine &$AUTOLOAD called"); |
59
|
|
|
|
|
|
|
} |
60
|
1
|
|
|
|
|
5
|
sig_translate_setup; |
61
|
1
|
|
|
2
|
|
9
|
*sig_num = sub ($) { $Sig_num{$_[0]} }; |
|
2
|
|
|
|
|
13
|
|
62
|
1
|
|
|
2
|
|
6
|
*sig_name = sub ($) { $Sig_name[$_[0]] }; |
|
2
|
|
|
|
|
10
|
|
63
|
1
|
|
|
|
|
6
|
goto &$AUTOLOAD; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |