blib/lib/Config/LNPath.pm

filter: Statementstmt 100% 33 / 33 Branchbran 100% 12 / 12 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 10 / 10 Podpod 100% 3 / 3 totaltotal 100% 61 / 61 CC 8 SCAR 11.0
CC
8
Cov
100%
new
6.0
find
2.0
section_find
2.0
CRAP 3.0
↑ Summary
1 package Config::LNPath;
2  
3 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $VERSION = '1.01';
8  
9 2 ▶use YAML::XS qw/LoadFile/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Data::LNPath qw/lnpath/, {
Subroutine BEGIN: called CC=1 SCAR=0.0
11 return_undef => 1
12 2 };
13 2 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use Blessed::Merge;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 4 ▶sub new {
Subroutine new: called CC=6 SCAR=17.9
Pod documented
17 4 ▶ my $self = bless $_[1] // {}, $_[0];
Condition100%2/2
$_[1] // {}
l!l
31
MC/DC100%1/1
$_[1] // {}
$_[1]
Truth table100%2/2
A
A= $_[1]
Aresult
11
00
18 4 ▶ croak "no config path passed to new" unless $self->{config};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"config"} 1 3 4
19 3 ▶ my $blessed = Blessed::Merge->new({ blessed => 0, ($self->{merge} ? %{ $self->{merge} } : ()) });
Branch: 1 branch
BranchTrueFalseTotal
$self->{'merge'} ? : 1 2 3
20 $self->{data} = ref $self->{config} eq 'ARRAY'
21 4 ? $blessed->merge(map { LoadFile($_) } @{ $self->{config} })
22 3 ▶ : LoadFile($self->{config});
Branch: 1 branch
BranchTrueFalseTotal
ref $self->{'config'} eq 'ARRAY' ? : 2 1 3
23 3 ▶ $self->{data} = $self->{data}->{$self->{section}} if $self->{section};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"section"} 1 2 3
24 3 $self;
25 }
26  
27 9 ▶sub find {
Subroutine find: called CC=2 SCAR=6.9
Pod documented
28 9 ▶ lnpath($_[0]->{data}, $_[1])
Branch: 1 branch
BranchTrueFalseTotal
lnpath($_[0]{"data"}, $_[1]) or croak(sprintf('Could not find value from config using path -> %s', $_[1])) 8 1 9
29 or croak sprintf "Could not find value from config using path -> %s", $_[1];
30 }
31  
32 3 ▶sub section_find {
Subroutine section_find: called CC=2 SCAR=6.9
Pod documented
33 3 ▶ lnpath($_[0]->{data}->{$_[1]}, $_[2])
Branch: 1 branch
BranchTrueFalseTotal
lnpath($_[0]{"data"}{$_[1]}, $_[2]) or croak(sprintf('Could not find value from config section -> %s', $_[1])) 2 1 3
34 or croak sprintf "Could not find value from config section -> %s", $_[1];
35 }
36  
37 2 1; # End of Config::LNPath
38  
39 __END__
↑ Summary