blib/lib/Signal/StackTrace/CarpLike.pm

filter: Statementstmt 84.6% 22 / 26 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 80.5% 29 / 36 CC 3 SCAR 8.8
CC
3
Cov
77%
import
4.8
BEGIN
1.0
BEGIN
1.0
CRAP 2.4
↑ Summary
1 ########################################################################
2 # Signal::StackTrace::CarpLike - run a stack dump on a signal.
3 ########################################################################
4 ########################################################################
5 # housekeeping
6 ########################################################################
7  
8 package Signal::StackTrace::CarpLike;
9  
10 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 ########################################################################
20 # package variables
21 ########################################################################
22  
23 1 our $VERSION = 0.01;
24  
25 1 my %known_sigz = ();
26  
27 1 @known_sigz{ split ' ', $Config{ sig_name } } = ();
28  
29 ########################################################################
30 # install the signal handlers
31 ########################################################################
32  
33 sub import
34 1 ▶{
Subroutine import: called CC=3 SCAR=15.7
35 # discard this package;
36 # remainder of the stack are signal names.
37  
38 1 shift;
39  
40 1 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 1 1
41 {
42 0 ▶ if( my @junk = grep { ! exists $known_sigz{ $_ } } @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (my(@junk) = grep({not exists $known_sigz{$_};} @_)) 0 0 0
43 {
44 0 croak "Unknown signals: unknown signals @junk";
45 }
46  
47 # all the signals are known, install them all
48 # with the cluck handler.
49  
50 0 @SIG{ @_ } = ( \&Carp::cluck ) x @_;
51 }
52 else
53 {
54 1 $SIG{ USR1 } = \&Carp::cluck;
55 }
56  
57 return
58 1 }
59  
60 # keep require happy
61  
62 1 1
63  
64 __END__
↑ Summary