X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FComponent.pm;h=d4cf7e59f768e96d70bc1a1619a1bc602c1c6da4;hb=908e3d9e7a61974b3807b7ab37862550452b2456;hp=b38361e2daa9c4951070fa454a4ca0e1bde95cf2;hpb=baf6a3dbf99be93d8e8bd9b986a95ad1d81a61ca;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Component.pm b/lib/Catalyst/Component.pm index b38361e..d4cf7e5 100644 --- a/lib/Catalyst/Component.pm +++ b/lib/Catalyst/Component.pm @@ -3,6 +3,7 @@ package Catalyst::Component; use strict; use base qw/Class::Accessor::Fast Class::Data::Inheritable/; use NEXT; +use Catalyst::Utils; __PACKAGE__->mk_classdata($_) for qw/_config _plugins/; @@ -134,7 +135,7 @@ sub process { . " did not override Catalyst::Component::process" ); } -=head2 $c->merge_hash_config( $hashref, $hashref ) +=head2 $c->merge_config_hashes( $hashref, $hashref ) Merges two hashes together recursively, giving right-hand precedence. @@ -143,21 +144,7 @@ Merges two hashes together recursively, giving right-hand precedence. sub merge_config_hashes { my ( $self, $lefthash, $righthash ) = @_; - my %merged = %$lefthash; - for my $key ( keys %$righthash ) { - my $right_ref = ( ref $righthash->{ $key } || '' ) eq 'HASH'; - my $left_ref = ( ( exists $lefthash->{ $key } && ref $lefthash->{ $key } ) || '' ) eq 'HASH'; - if( $right_ref and $left_ref ) { - $merged{ $key } = $self->merge_config_hashes( - $lefthash->{ $key }, $righthash->{ $key } - ); - } - else { - $merged{ $key } = $righthash->{ $key }; - } - } - - return \%merged; + return Catalyst::Utils::merge_hashes( $lefthash, $righthash ); } =head1 OPTIONAL METHODS