Config.pm

filter: Statementstmt 91.1% 31 / 34 Branchbran 83.3% 5 / 6 Conditioncond 33.3% 2 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 90.0% 9 / 10 Podpod 100% 7 / 7 totaltotal 82.0% 55 / 67 CC 7 SCAR 8.7
CC
7
Cov
83%
serialize
6.0
but
3.0
get
2.1
CRAP 2.4
« Config/MakeMaker.pm ↑ Summary
1 package ExtUtils::Config;
2 2 $ExtUtils::Config::VERSION = '0.010';
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
8 3 my ($pack, $args) = @_;
9 3 ▶ return bless {
Branch: 1 branch
BranchTrueFalseTotal
$args ? : 2 1 3
10 values => ($args ? { %$args } : {}),
11 }, $pack;
12 }
13  
14 3 ▶sub get {
Subroutine get: called CC=2 SCAR=7.2
Pod documented
15 3 my ($self, $key) = @_;
16 3 ▶ return exists $self->{values}{$key} ? $self->{values}{$key} : $Config{$key};
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'values'}{$key} ? : 0 3 3
17 }
18  
19 2 ▶sub exists {
Subroutine exists: called CC=2 SCAR=7.1
Pod documented
20 2 my ($self, $key) = @_;
21 2 ▶ return exists $self->{values}{$key} || exists $Config{$key};
Condition66%2/3
exists $self->{'values'}{$key} || exists $ExtUtils::Config::Config{$key}
l!l&&r!l&&!r
011
MC/DC50%1/2
exists $self->{'values'}{$key} || exists $ExtUtils::Config::Config{$key}
exists $self->{'values'}{$key} exists $ExtUtils::Config::Config{$key}
Truth table66%2/3
A || B
A= exists $self->{'values'}{$key}B= exists $ExtUtils::Config::Config{$key}
ABresult
1X1
011
000
22 }
23  
24 4 ▶sub values_set {
Subroutine values_set: called CC=1 SCAR=0.0
Pod documented
25 4 my $self = shift;
26 4 return { %{$self->{values}} };
27 }
28  
29 4 ▶sub all_config {
Subroutine all_config: called CC=1 SCAR=0.0
Pod documented
30 4 my $self = shift;
31 4 return { %Config, %{ $self->{values}} };
32 }
33  
34 0 ▶sub serialize {
Subroutine serialize: not called CC=2 SCAR=17.9
Pod documented
35 0 my $self = shift;
36 0 require Data::Dumper;
37 0 ▶ return $self->{serialized} ||= Data::Dumper->new([ $self->{values} ])->Terse(1)->Sortkeys(1)->Dump;
Condition0%0/3
$self->{"serialized"} ||= "Data::Dumper"->new([$self->{"values"}])->Terse(1)->Sortkeys(1)->Dump
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"serialized"} ||= "Data::Dumper"->new([$self->{"values"}])->Terse(1)->Sortkeys(1)->Dump
$self->{"serialized"} "Data::Dumper"->new([$self->{"values"}])->Terse(1)->Sortkeys(1)->Dump
Truth table0%0/3
A ||= B
A= $self->{"serialized"}B= "Data::Dumper"->new([$self->{"values"}])->Terse(1)->Sortkeys(1)->Dump
ABresult
1X1
011
000
38 }
39  
40 1 ▶sub but {
Subroutine but: called CC=3 SCAR=11.0
Pod documented
41 1 my ($self, $args) = @_;
42 1 my %new = %{ $self->{values} };
43 1 for my $key (keys %$args) {
44 2 ▶ if (defined $args->{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args->{$key}) { } 1 1 2
45 1 $new{$key} = $args->{$key}
46 }
47 else {
48 1 delete $new{$key};
49 }
50 }
51 1 return bless { values => \%new }, ref $self;
52 }
53  
54 2 1;
55  
56 # ABSTRACT: A wrapper for perl's configuration
57  
58 __END__
« Config/MakeMaker.pm ↑ Summary