| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Kelp::Module::Config::General; | 
| 2 | 5 |  |  | 5 |  | 2239 | use strict; | 
|  | 5 |  |  |  |  | 5 |  | 
|  | 5 |  |  |  |  | 111 |  | 
| 3 | 5 |  |  | 5 |  | 85 | use 5.008_005; | 
|  | 5 |  |  |  |  | 10 |  | 
| 4 | 5 |  |  | 5 |  | 17 | use Kelp::Base 'Kelp::Module::Config'; | 
|  | 5 |  |  |  |  | 5 |  | 
|  | 5 |  |  |  |  | 25 |  | 
| 5 | 5 |  |  | 5 |  | 50563 | use Config::General; | 
|  | 5 |  |  |  |  | 59263 |  | 
|  | 5 |  |  |  |  | 1052 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | our $VERSION = '0.03'; | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | attr ext => 'conf'; | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | sub load { | 
| 12 | 9 |  |  | 9 | 1 | 1944 | my ( $self, $filename ) = @_; | 
| 13 |  |  |  |  |  |  |  | 
| 14 | 9 |  |  |  |  | 43 | my $conf = Config::General->new( | 
| 15 |  |  |  |  |  |  | -ConfigFile      => $filename, | 
| 16 |  |  |  |  |  |  | -ForceArray      => 1, | 
| 17 |  |  |  |  |  |  | -IncludeAgain    => 1, | 
| 18 |  |  |  |  |  |  | -InterPolateVars => 1, | 
| 19 |  |  |  |  |  |  | ); | 
| 20 | 9 |  |  |  |  | 13233 | my %config = $conf->getall; | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | # Hack for using default Log::Dispatch | 
| 23 | 9 | 100 |  |  |  | 87 | if ( exists $config{modules_init}{Logger} ) { | 
| 24 | 2 |  |  |  |  | 5 | my $outputs = $config{modules_init}{Logger}{outputs}; | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | my @outputs = map { | 
| 27 | 2 |  |  |  |  | 4 | my ( $k, $v ) = ($_, $outputs->{$_}); | 
|  | 2 |  |  |  |  | 5 |  | 
| 28 | 2 |  |  |  |  | 2 | my @res; | 
| 29 | 2 | 50 |  |  |  | 10 | push @res, ( ref $v eq 'ARRAY' ) ? map { [ $k, %$_ ] } @$v | 
|  | 2 | 100 |  |  |  | 13 |  | 
| 30 |  |  |  |  |  |  | : ( ref $v eq 'HASH'  ) ? [ $k, %$v ] | 
| 31 |  |  |  |  |  |  | :                         []; | 
| 32 | 2 |  |  |  |  | 6 | @res; | 
| 33 |  |  |  |  |  |  | } keys %$outputs; | 
| 34 | 2 |  |  |  |  | 6 | $config{modules_init}{Logger}{outputs} = \@outputs; | 
| 35 |  |  |  |  |  |  | } | 
| 36 |  |  |  |  |  |  |  | 
| 37 | 9 |  |  |  |  | 110 | return \%config; | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | 1; | 
| 41 |  |  |  |  |  |  | __END__ |