| 1 | package App::Rad::Plugin::ConfigLoader; | ||
| 2 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 2 | ▶ | use Config::Any; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 2 | our $VERSION = '0.01'; | |
| 8 | |||
| 9 | 0 | ▶ | sub load_config { |
|
Subroutine
load_config: not called CC=3 SCAR=24.8
Pod
documented
| |||
| 10 | 0 | my ($c, @filepaths) = (@_); | |
| 11 | |||
| 12 | 0 | my $cfg = Config::Any->load_files({ | |
| 13 | 'files' => \@filepaths, | ||
| 14 | 'use_ext' => 1 | ||
| 15 | }); | ||
| 16 | 0 | foreach ( @{$cfg} ) { | |
| 17 | 0 | my ($filename, $config) = %{$_}; | |
| 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}) { | |
| 23 | 0 | $c->config->{$key} = $config->{$key}; | |
| 24 | } | ||
| 25 | } | ||
| 26 | } | ||
| 27 | |||
| 28 | 2 | 42; | |
| 29 | __END__ | ||