blib/lib/Devel/CompileLevel.pm

filter: Statementstmt 100% 31 / 31 Branchbran 90.0% 9 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 2 / 2 totaltotal 98.0% 51 / 52 CC 6 SCAR 7.0
CC
6
Cov
98%
compile_level
3.0
compile_caller
3.0
BEGIN
2.1
CRAP 2.0
↑ Summary
1 package Devel::CompileLevel;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶no warnings 'once';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '0.001004';
7 1 $VERSION =~ tr/_//d;
8  
9 1 ▶use Exporter (); BEGIN { *import = \&Exporter::import }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.6
11 1 ▶ *_WARNING_BITS_CHECK = "$]" <= 5.030001 ? sub(){1} : sub(){0};
Branch: 1 branch
BranchTrueFalseTotal
"$]" <= 5.030001 ? : 0 1 1
12 }
13  
14 1 our @EXPORT_OK = qw(
15 compile_level
16 compile_caller
17 );
18  
19 15 ▶sub compile_level () {
Subroutine compile_level: called CC=3 SCAR=11.0
Pod documented
20 1 ▶ no warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 15 if (_WARNING_BITS_CHECK) {
22 local ${^WARNING_BITS} = $warnings::NONE;
23 my $level = 0;
24 while (my @caller = caller(++$level)) {
25 my $hints = $caller[9];
26 next
27 if $hints ne ${^WARNING_BITS};
28 ${^WARNING_BITS} ^= "\x01";
29 my $newhints = (caller($level))[9];
30 if ($newhints ne $hints) {
31 return $level - 1;
32 }
33 }
34 }
35 else {
36 15 my $level = 0;
37 15 ▶ while (my @caller = caller(++$level)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@caller) = caller ++$level) 39 4 43
38 39 ▶ return $level - 1
Branch: 1 branch
BranchTrueFalseTotal
if $caller[3] =~ /::BEGIN\z/ 11 28 39
39 if $caller[3] =~ /::BEGIN\z/;
40 }
41 }
42 4 return undef;
43 }
44  
45 8 ▶sub compile_caller () {
Subroutine compile_caller: called CC=3 SCAR=11.0
Pod documented
46 8 my $level = compile_level;
47 return
48 8 ▶ unless defined $level;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $level 1 7 8
49  
50 7 ▶ if (caller eq 'DB') {
Branch: 1 branch
BranchTrueFalseTotal
if (caller eq 'DB') { } 1 6 7
51 package
52 DB;
53 1 caller($level - 1);
54 }
55 else {
56 6 caller($level - 1);
57 }
58 }
59  
60 1 1;
61  
62 __END__
↑ Summary