blib/lib/Kelp/Module/Config/ConfigGeneral.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::ConfigGeneral;
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.03';
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 );
20 9 my %config = $conf->getall;
21  
22 # Hack for using default Log::Dispatch
23 9 ▶ if ( exists $config{modules_init}{Logger} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $config{"modules_init"}{"Logger"}) 2 7 9
24 2 my $outputs = $config{modules_init}{Logger}{outputs};
25
26 my @outputs = map {
27 2 my ( $k, $v ) = ($_, $outputs->{$_});
28 2 my @res;
29 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
30 : ( ref $v eq 'HASH' ) ? [ $k, %$v ]
31 : [];
32 2 @res;
33 } keys %$outputs;
34 2 $config{modules_init}{Logger}{outputs} = \@outputs;
35 }
36
37 9 return \%config;
38 }
39  
40 5 1;
41 __END__
↑ Summary