EndOfScope/PP.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 92.1% 35 / 38 CC 4 SCAR 6.5
CC
4
Cov
91%
__invoke_callback
3.0
BEGIN
2.1
BEGIN
1.0
CRAP 1.9
« EndOfScope/PP/HintHash.pm ↑ Summary EndOfScope/PP/FieldHash.pm »
1 package B::Hooks::EndOfScope::PP;
2 # ABSTRACT: Execute code after a scope finished compilation - PP implementation
3  
4 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 7 our $VERSION = '0.28';
8  
9 7 ▶use constant _PERL_VERSION => "$]";
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 7 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.6
12 7 ▶ if (_PERL_VERSION =~ /^5\.009/) {
Branch: 1 branch
BranchTrueFalseTotal
if (5.044 =~ /^5\.009/) { } 0 7 7
13 # CBA to figure out where %^H got broken and which H::U::HH is sane enough
14 0 die "By design B::Hooks::EndOfScope does not operate in pure-perl mode on perl 5.9.X\n"
15 }
16 elsif (_PERL_VERSION < '5.010') {
17 require B::Hooks::EndOfScope::PP::HintHash;
18 *on_scope_end = \&B::Hooks::EndOfScope::PP::HintHash::on_scope_end;
19 }
20 else {
21 7 require B::Hooks::EndOfScope::PP::FieldHash;
22 7 *on_scope_end = \&B::Hooks::EndOfScope::PP::FieldHash::on_scope_end;
23 }
24 }
25  
26 7 ▶use Sub::Exporter::Progressive 0.001006 -setup => {
Subroutine BEGIN: called CC=1 SCAR=0.0
27 exports => ['on_scope_end'],
28 groups => { default => ['on_scope_end'] },
29 7 };
30  
31 11 ▶sub __invoke_callback {
Subroutine __invoke_callback: called CC=3 SCAR=11.0
32 11 local $@;
33 11 ▶ eval { $_[0]->(); 1 } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $_[0]->(); 1 } } or do { my $err = $@; require Carp; Carp::cluck('A scope-end callback raised an exception, which can not be propagated when B::Hooks::EndOfScope operates in pure-perl mode. Your program will CONTINUE EXECUTION AS IF NOTHING HAPPENED AFTER THIS WARNING. Below is the complete exception text, followed by a stack-trace of the callback execution:' . "\n\n$err\n\r"); sleep 1 if -t *STDERR } 10 1 11
34 1 my $err = $@;
35 1 require Carp;
36 1 Carp::cluck( (join ' ',
37 'A scope-end callback raised an exception, which can not be propagated when',
38 'B::Hooks::EndOfScope operates in pure-perl mode. Your program will CONTINUE',
39 'EXECUTION AS IF NOTHING HAPPENED AFTER THIS WARNING. Below is the complete',
40 'exception text, followed by a stack-trace of the callback execution:',
41 ) . "\n\n$err\n\r" );
42  
43 1 ▶ sleep 1 if -t *STDERR; # maybe a bad idea...?
Branch: 1 branch
BranchTrueFalseTotal
if -t *STDERR 0 1 1
44 };
45 }
46  
47 7 1;
48  
49 __END__
« EndOfScope/PP/HintHash.pm ↑ Summary EndOfScope/PP/FieldHash.pm »