Skip Menu |

This queue is for tickets about the Config-Any-Merge CPAN distribution.

Report information
The Basics
Id: 46789
Status: resolved
Worked: 30 min
Priority: 0/
Queue: Config-Any-Merge

People
Owner: MDOM [...] cpan.org
Requestors: stephen [...] enterity.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.06
Fixed in: 0.07



Subject: missing or bad config files listed in $args->{files} wipes the merged config hash
If a file listed in $args->{files} is not processed by Config::Any for any reason (meaning it has no key in the $config_any returned by SUPER::_load), the merge function will wipe all the config information that comes before it when merging. A simple grep filter on existant keys avoids this: @@ -28,7 +28,7 @@ my $config_any = $class->SUPER::_load($args); - foreach my $file (@{$args->{files}}) { + foreach my $file ( grep { exists $config_any->{$_} } @{$args->{files}}) { $config_merged = merge($config_merged, $config_any->{$file}); #while (my ($key,$val) = each %{$config_any->{$file}}) { #$config_merged{$key} = $val;
Hello, thanks for the supplied patch. You're absolutely right, that shouldn't happen. I applied your patch, written a test case that results in this bug and packaged version 0.07 which should hit cpan any minute now. Best wishes, Mario