diff options
-rw-r--r-- | lib/App/ArchLinux/PackagerTools/Config.pm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/App/ArchLinux/PackagerTools/Config.pm b/lib/App/ArchLinux/PackagerTools/Config.pm index 4477053..bd8dfc1 100644 --- a/lib/App/ArchLinux/PackagerTools/Config.pm +++ b/lib/App/ArchLinux/PackagerTools/Config.pm @@ -4,7 +4,7 @@ use strictures; use autodie; use Function::Parameters; use Log::Any qw($log); -use Hash::Merge; +use Hash::Merge qw(merge); use Path::Tiny; use TOML qw(from_toml); @@ -81,12 +81,15 @@ method _load_config() { my $file = path(($ENV{XDG_CONFIG_HOME} // $ENV{HOME}."/.config")."/perlpkg/config.toml"); if ($file->exists) { $log->debugf("Reading config file: %s", $file); - my $file_config = from_toml($file->slurp); + my ($file_config, $err) = from_toml($file->slurp); + die $log->errorf("Failed to parse config file: %s", $err) unless $file_config; + $log->debugf("config = %s", $config); + $log->debugf("file_config = %s", $file_config); $config = merge($file_config, $config); - } else { $log->debug("Config file not found. Returning default config"); } + $log->debugf("Loaded configuration is: %s", $config); return $config; } |