line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sig::PackageScoped; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
32971
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
406
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our @EXPORT_OK = qw(set_sig unset_sig); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our %HANDLERS; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub import |
13
|
|
|
|
|
|
|
{ |
14
|
6
|
|
|
6
|
|
958
|
$SIG{__DIE__} = sub { my $package = caller(0); |
15
|
6
|
100
|
|
|
|
59
|
exists $HANDLERS{$package}{__DIE__} ? |
16
|
|
|
|
|
|
|
$HANDLERS{$package}{__DIE__}->(@_) : |
17
|
|
|
|
|
|
|
die @_; |
18
|
1
|
|
|
1
|
|
17
|
}; |
19
|
0
|
|
|
0
|
|
0
|
$SIG{__WARN__} = sub { my $package = caller(0); |
20
|
0
|
0
|
|
|
|
0
|
exists $HANDLERS{$package}{__WARN__} ? |
21
|
|
|
|
|
|
|
$HANDLERS{$package}{__WARN__}->(@_) : |
22
|
|
|
|
|
|
|
warn @_; |
23
|
1
|
|
|
|
|
6
|
}; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
2118
|
return; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub set_sig |
29
|
|
|
|
|
|
|
{ |
30
|
1
|
|
|
1
|
1
|
16
|
my %p = @_; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
33
|
|
|
13
|
my $package = $p{package} || caller(0); |
33
|
|
|
|
|
|
|
|
34
|
1
|
50
|
|
|
|
8
|
$HANDLERS{$package}{__DIE__} = $p{__DIE__} if exists $p{__DIE__}; |
35
|
1
|
50
|
|
|
|
4
|
$HANDLERS{$package}{__WARN__} = $p{__WARN__} if exists $p{__WARN__}; |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
3
|
return; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub unset_sig |
41
|
|
|
|
|
|
|
{ |
42
|
1
|
|
|
1
|
1
|
345
|
my %p = @_; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
33
|
|
|
9
|
my $package = delete $p{package} || caller(0); |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
4
|
delete @{ $HANDLERS{$package} }{ keys %p }; |
|
1
|
|
|
|
|
6
|
|
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
4
|
return; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |