X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FBase.pm;h=ec25476b1b70be7a35ff129bd0f34eaba48c71fa;hb=4f6748f101647dd3344339b19510947df6836412;hp=efc7aa71b488a8f68fb4bcf1d52feb5da3407339;hpb=d70195d8eedf0d77f77410ba32e12bc8f4138413;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Base.pm b/lib/Catalyst/Base.pm index efc7aa7..ec25476 100644 --- a/lib/Catalyst/Base.pm +++ b/lib/Catalyst/Base.pm @@ -2,11 +2,12 @@ package Catalyst::Base; use strict; use base qw/Class::Data::Inheritable Class::Accessor::Fast/; +use Catalyst::Utils; use NEXT; __PACKAGE__->mk_classdata($_) for qw/_attrcache _cache _config/; +__PACKAGE__->_attrcache( {} ); __PACKAGE__->_cache( [] ); -__PACKAGE__->_attrchache( {} ); # note - see attributes(3pm) sub MODIFY_CODE_ATTRIBUTES { @@ -16,7 +17,7 @@ sub MODIFY_CODE_ATTRIBUTES { return (); } -sub FETCH_CODE_ATTTRIBUTES { $_[0]->_attrcache->{ $_[1] } || () } +sub FETCH_CODE_ATTRIBUTES { $_[0]->_attrcache->{ $_[1] } || () } =head1 NAME @@ -69,7 +70,12 @@ component loader with config() support and a process() method placeholder. sub new { my ( $self, $c ) = @_; - return $self->NEXT::new( $self->config ); + my $class = ref $self || $self; + my $appname = Catalyst::Utils::class2appclass($class); + my $suffix = Catalyst::Utils::class2classsuffix($class); + my $appconfig = $appname->config->{$suffix} || {}; + my $config = { %{ $self->config }, %{$appconfig} }; + return $self->NEXT::new($config); } # remember to leave blank lines between the consecutive =item's