blib/lib/Devel/DieHandler/DumpDieArgs.pm

filter: Statementstmt 55.5% 15 / 27 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod n/a totaltotal 46.1% 18 / 39 CC 4 SCAR 14.7
CC
4
Cov
45%
import
6.0
__ANON__
6.0
unimport
6.0
CRAP 4.3
↑ Summary
1 package Devel::DieHandler::DumpDieArgs;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Data::Dmp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
9 1 our $DATE = '2022-10-27'; # DATE
10 1 our $DIST = 'Devel-DieHandler-DumpDieArgs'; # DIST
11 1 our $VERSION = '0.001'; # VERSION
12  
13 1 my @handler_stack;
14  
15 0 ▶sub import {
Subroutine import: not called CC=2 SCAR=17.9
16 0 my $pkg = shift;
17 0 ▶ push @handler_stack, $SIG{__DIE__} if $SIG{__DIE__};
Branch: 1 branch
BranchTrueFalseTotal
if $SIG{"__DIE__"} 0 0 0
18 0 ▶ $SIG{__DIE__} = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
19 0 local $SIG{__DIE__};
20 0 print STDERR "Content of \@_: ", Data::Dmp::dmp(\@_), "\n";
21 0 ▶ if (@handler_stack) {
Branch: 1 branch
BranchTrueFalseTotal
if (@handler_stack) { } 0 0 0
22 0 goto &{$handler_stack[-1]};
23 } else {
24 0 die @_;
25 }
26 0 };
27 }
28  
29 0 ▶sub unimport {
Subroutine unimport: not called CC=2 SCAR=17.9
30 0 my $pkg = shift;
31 0 ▶ if (@handler_stack) {
Branch: 1 branch
BranchTrueFalseTotal
if (@handler_stack) 0 0 0
32 0 $SIG{__DIE__} = pop(@handler_stack);
33 }
34 }
35  
36 1 1;
37 # ABSTRACT: Dump content of die arguments
38  
39 __END__
↑ Summary