blib/lib/Devel/NYTProf/Constants.pm

filter: Statementstmt 76.4% 26 / 34 Branchbran 25.0% 2 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 66.6% 32 / 48 CC 5 SCAR 28.4
CC
5
Cov
67%
const_bits2names
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 17.1
« blib/lib/Devel/NYTProf/FileInfo.pm ↑ Summary blib/lib/Devel/NYTProf/Run.pm »
1 package Devel::NYTProf::Constants;
2  
3 701 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 701 ▶use Devel::NYTProf::Core;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 701 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 701 our @EXPORT_OK = qw(const_bits2names);
10  
11 701 my $const_bits2names_groups;
12  
13 701 do {
14 701 ▶ my $symbol_table = do { no strict; \%{"Devel::NYTProf::Constants::"} };
Subroutine BEGIN: called CC=1 SCAR=0.0
15 701 my %consts = map { $_ => $symbol_table->{$_}() } grep { /^NYTP_/ } keys %$symbol_table;
16  
17 701 push @EXPORT_OK, keys %consts;
18  
19 701 for my $sym (keys %consts) {
20 32947 ▶ $sym =~ /^(NYTP_[A-Z]+[a-z])_/ or next;
Branch: 1 branch
BranchTrueFalseTotal
$sym =~ /^(NYTP_[A-Z]+[a-z])_/ or next 30143 2804 32947
21 30143 $const_bits2names_groups->{$1}{ $consts{$sym} } = $sym;
22 }
23 };
24  
25  
26 0 ▶sub const_bits2names { # const_bits2names("NYTP_FIDf",$flags)
Subroutine const_bits2names: not called CC=5 SCAR=34.0
Pod undocumented
27 0 my ($group, $bits) = @_;
28 0 ▶ my $names = $const_bits2names_groups->{$group} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $names = $const_bits2names_groups->{$group} or return 0 0 0
29 0 my @names;
30 0 for my $bit (0..31) {
31 0 my $bitval = 1 << $bit;
32 0 ▶ push @names, $names->{$bitval}
Branch: 1 branch
BranchTrueFalseTotal
if $bits & $bitval 0 0 0
33 if $bits & $bitval;
34 }
35 0 ▶ return @names if wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if wantarray 0 0 0
36 0 return join " | ", @names;
37 }
38  
39 # warn scalar const_bits2names("NYTP_FIDf", NYTP_FIDf_SAVE_SRC|NYTP_FIDf_IS_PMC);
40  
41  
42 #warn "Constants: ".join(" ", sort @EXPORT_OK);
43  
44 701 1;
« blib/lib/Devel/NYTProf/FileInfo.pm ↑ Summary blib/lib/Devel/NYTProf/Run.pm »