| App-HistHub documentation | Contained in the App-HistHub distribution. |
App::HistHub::ConfigLoader - App::HistHub ConfigLoader class
See App::HistHub.
Daisuke Murase <typester@cpan.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
| App-HistHub documentation | Contained in the App-HistHub distribution. |
package App::HistHub::ConfigLoader; use strict; use warnings; use FindBin::libs qw/export/; use File::HomeDir; use YAML;
sub load { my @files; my $base = (@App::HistHub::ConfigLoader::lib)[0]; if ($base) { push @files, "$base/config.yaml"; push @files, "$base/config_local.yaml"; } push @files, File::HomeDir->my_home . '/.histhub'; my $conf = {}; for my $file (@files) { next unless -f $file && -s _ && -r _; my $c = YAML::LoadFile($file); for my $k (keys %$c) { $conf->{$k} = $c->{$k}; } } $conf; }
1;