blib/lib/Kelp/Module/Config/General.pm

filter: Statementstmt 100% 27 / 27 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 97.4% 38 / 39 CC 4 SCAR 9.2
CC
4
Cov
97%
load
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.5
↑ Summary
1 package Kelp::Module::Config::General;
2 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use 5.008_005;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use Kelp::Base 'Kelp::Module::Config';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use Config::General;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 5 our $VERSION = '0.04';
8  
9 5 attr ext => 'conf';
10  
11 9 ▶sub load {
Subroutine load: called CC=4 SCAR=13.9
Pod documented
12 9 my ( $self, $filename ) = @_;
13  
14 9 my $conf = Config::General->new(
15 -ConfigFile => $filename,
16 -ForceArray => 1,
17 -IncludeAgain => 1,
18 -InterPolateVars => 1,
19 -IncludeRelative => 1,
20 );
21 9 my %config = $conf->getall;
22  
23 # Hack for using default Log::Dispatch
24 9 ▶ if ( exists $config{modules_init}{Logger} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $config{"modules_init"}{"Logger"}) 2 7 9
25 2 my $outputs = $config{modules_init}{Logger}{outputs};
26
27 my @outputs = map {
28 2 my ( $k, $v ) = ($_, $outputs->{$_});
29 2 my @res;
30 2 ▶ push @res, ( ref $v eq 'ARRAY' ) ? map { [ $k, %$_ ] } @$v
Branch: 2 branches
BranchTrueFalseTotal
ref $v eq 'ARRAY' ? : 1 1 2
ref $v eq 'HASH' ? : 1 0 1
31 : ( ref $v eq 'HASH' ) ? [ $k, %$v ]
32 : [];
33 2 @res;
34 } keys %$outputs;
35 2 $config{modules_init}{Logger}{outputs} = \@outputs;
36 }
37
38 9 return \%config;
39 }
40  
41 5 1;
42 __END__
↑ Summary