| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::Rad::Plugin::ConfigLoader; | 
| 2 | 1 |  |  | 1 |  | 25666 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 41 |  | 
| 3 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 30 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 1 |  |  | 1 |  | 1220 | use Config::Any; | 
|  | 1 |  |  |  |  | 16073 |  | 
|  | 1 |  |  |  |  | 284 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | our $VERSION = '0.01'; | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | sub load_config { | 
| 10 | 0 |  |  | 0 | 1 |  | my ($c, @filepaths) = (@_); | 
| 11 |  |  |  |  |  |  |  | 
| 12 | 0 |  |  |  |  |  | my $cfg = Config::Any->load_files({ | 
| 13 |  |  |  |  |  |  | 'files' => \@filepaths, | 
| 14 |  |  |  |  |  |  | 'use_ext' => 1 | 
| 15 |  |  |  |  |  |  | }); | 
| 16 | 0 |  |  |  |  |  | foreach ( @{$cfg} ) { | 
|  | 0 |  |  |  |  |  |  | 
| 17 | 0 |  |  |  |  |  | my ($filename, $config) = %{$_}; | 
|  | 0 |  |  |  |  |  |  | 
| 18 | 0 |  |  |  |  |  | $c->debug("loaded configuration from file '$filename'."); | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | # I could just fiddle with the internals to make this | 
| 21 |  |  |  |  |  |  | # a little quicker, but let's stick to the API :) | 
| 22 | 0 |  |  |  |  |  | foreach my $key (keys %{$config}) { | 
|  | 0 |  |  |  |  |  |  | 
| 23 | 0 |  |  |  |  |  | $c->config->{$key} = $config->{$key}; | 
| 24 |  |  |  |  |  |  | } | 
| 25 |  |  |  |  |  |  | } | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | 42; | 
| 29 |  |  |  |  |  |  | __END__ |