X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FBase.pm;h=789c6ab9f987b41334456a1761e787f5c9e36946;hb=78d760bb64c2142042834b11911b728259e3005d;hp=64848c076f0b5709d5204bc0d5bbae7a70a4a300;hpb=812a28c90c5b43bdf5ce87f1b2a688725e552429;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Base.pm b/lib/Catalyst/Base.pm index 64848c0..789c6ab 100644 --- a/lib/Catalyst/Base.pm +++ b/lib/Catalyst/Base.pm @@ -2,7 +2,8 @@ package Catalyst::Base; use strict; use base qw/Class::Data::Inheritable Class::Accessor::Fast/; -use Catalyst::Utils; + +use Catalyst::Exception; use NEXT; __PACKAGE__->mk_classdata($_) for qw/_attr_cache _action_cache _config/; @@ -70,12 +71,11 @@ component loader with config() support and a process() method placeholder. sub new { my ( $self, $c ) = @_; - 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); + + # Temporary fix, some components does not pass context to constructor + my $arguments = ( ref( $_[-1] ) eq 'HASH' ) ? $_[-1] : {}; + + return $self->NEXT::new( { %{ $self->config }, %{ $arguments } } ); } # remember to leave blank lines between the consecutive =item's @@ -106,9 +106,16 @@ sub config { =cut sub process { - die( ( ref $_[0] || $_[0] ) . " did not override Catalyst::Base::process" ); + + Catalyst::Exception->throw( + message => ( ref $_[0] || $_[0] ) . " did not override Catalyst::Base::process" + ); } +=item FETCH_CODE_ATTRIBUTES + +=item MODIFY_CODE_ATTRIBUTES + =back =head1 SEE ALSO