X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FPlugin%2FConfigLoader.pm;h=edc69d4d1f5b9e8d8e5d73a705add14197b60822;hb=7b57af9843be04349c493927c39d2253032f913f;hp=760c57edfae51f1d53f7bfa69cae3bfd85c1523b;hpb=94621b2636dd344b503a8910db871bfd7517b2bf;p=catagits%2FCatalyst-Plugin-ConfigLoader.git diff --git a/lib/Catalyst/Plugin/ConfigLoader.pm b/lib/Catalyst/Plugin/ConfigLoader.pm index 760c57e..edc69d4 100644 --- a/lib/Catalyst/Plugin/ConfigLoader.pm +++ b/lib/Catalyst/Plugin/ConfigLoader.pm @@ -68,8 +68,24 @@ sub setup { my $config = $loader->load( $_ ); $c->log->debug( "Loaded Config $_" ) if $c->debug; - _fix_syntax( $config ); - $c->config( $config ) if $config; + + next if !$config; + + _fix_syntax( $config ); + + # merge hashes 1 level down + for my $key ( keys %$config ) { + if( exists $c->config->{ $key } ) { + my $isa_ref = ref $config->{ $key }; + + next if !$isa_ref or $isa_ref ne 'HASH'; + + my %temp = ( %{ $c->config->{ $key } }, %{ $config->{ $key } } ); + $config->{ $key } = \%temp; + } + } + + $c->config( $config ); } }