X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FComponent.pm;h=aac0b64cb673ac7a1cd0028cbeeb2487bcd96392;hb=8e061fef6ed2e38808032cbb722098c5c183ec03;hp=116aa9ad8dab10a71f01adf705a69f49d0f6502a;hpb=300633a88f8eb00275336ef1088036a117c60478;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Component.pm b/lib/Catalyst/Component.pm index 116aa9a..aac0b64 100644 --- a/lib/Catalyst/Component.pm +++ b/lib/Catalyst/Component.pm @@ -1,11 +1,14 @@ package Catalyst::Component; -use strict; -use base qw/Class::Accessor::Fast Class::Data::Inheritable/; -use NEXT; +use Moose; +use MooseX::Adopt::Class::Accessor::Fast; use Catalyst::Utils; +with 'MooseX::Emulate::Class::Accessor::Fast'; +with 'Catalyst::ClassData'; + + =head1 NAME Catalyst::Component - Catalyst Component Base Class @@ -51,38 +54,38 @@ component loader with config() support and a process() method placeholder. __PACKAGE__->mk_classdata($_) for qw/_config _plugins/; - - -sub new { +around new => sub { + my $orig = shift; my ( $self, $c ) = @_; # Temporary fix, some components does not pass context to constructor my $arguments = ( ref( $_[-1] ) eq 'HASH' ) ? $_[-1] : {}; - return $self->NEXT::new( - $self->merge_config_hashes( $self->config, $arguments ) ); -} + my $args = $self->merge_config_hashes( $self->config, $arguments ); + return $self->$orig( $args ); +}; sub COMPONENT { my ( $self, $c ) = @_; # Temporary fix, some components does not pass context to constructor my $arguments = ( ref( $_[-1] ) eq 'HASH' ) ? $_[-1] : {}; - - if ( my $new = $self->NEXT::COMPONENT( $c, $arguments ) ) { - return $new; - } - else { - if ( my $new = $self->new( $c, $arguments ) ) { - return $new; - } - else { - my $class = ref $self || $self; - my $new = $self->merge_config_hashes( - $self->config, $arguments ); - return bless $new, $class; - } - } + $self->new($c, $arguments); + +# if ( my $new = $self->NEXT::COMPONENT( $c, $arguments ) ) { +# return $new; +# } +# else { +# if ( my $new = $self->new( $c, $arguments ) ) { +# return $new; +# } +# else { +# my $class = ref $self || $self; +# my $new = $self->merge_config_hashes( +# $self->config, $arguments ); +# return bless $new, $class; +# } +# } } sub config {