X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FComponent.pm;h=a66a7c206653aba4d04e5b987d79eda91dd14708;hb=76aab9932e14205c81eeb31d811d2a131eede4cf;hp=0d8078541323022116dd24195bbd2b443cd06cec;hpb=efbfd430a9e62335eca426a2be3bc098d65f8d1a;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Component.pm b/lib/Catalyst/Component.pm index 0d80785..a66a7c2 100644 --- a/lib/Catalyst/Component.pm +++ b/lib/Catalyst/Component.pm @@ -84,29 +84,12 @@ sub COMPONENT { sub config { my $self = shift; - my $config_sub = $self->can('_config'); - my $config = $self->$config_sub() || {}; + my $config = $self->_config ||{}; if (@_) { my $newconfig = { %{@_ > 1 ? {@_} : $_[0]} }; $self->_config( $self->merge_config_hashes( $config, $newconfig ) ); - } else { - # this is a bit of a kludge, required to make - # __PACKAGE__->config->{foo} = 'bar'; - # work in a subclass. Calling the Class::Data::Inheritable setter - # will create a new _config method in the current class if it's - # currently inherited from the superclass. So, the can() call will - # return a different subref in that case and that means we know to - # copy and reset the value stored in the class data. - - $self->_config( $config ); - - if ((my $config_sub_now = $self->can('_config')) ne $config_sub) { - - $config = $self->merge_config_hashes( $config, {} ); - $self->$config_sub_now( $config ); - } } return $config; }