From: André Walker Date: Thu, 4 Aug 2011 23:41:55 +0000 (-0300) Subject: reordering stuff fixes accept_context_args X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b489e5dff0610863a41305ed3fa9e32230f10ba5;p=catagits%2FCatalyst-Runtime.git reordering stuff fixes accept_context_args --- diff --git a/lib/Catalyst/IOC/BlockInjection.pm b/lib/Catalyst/IOC/BlockInjection.pm index 4453e84..2e618d1 100644 --- a/lib/Catalyst/IOC/BlockInjection.pm +++ b/lib/Catalyst/IOC/BlockInjection.pm @@ -2,9 +2,9 @@ package Catalyst::IOC::BlockInjection; use Moose; extends 'Bread::Board::BlockInjection'; -with 'Bread::Board::Service::WithDependencies', - 'Catalyst::IOC::Service::WithParameters', - 'Catalyst::IOC::Service::WithAcceptContext'; +with 'Catalyst::IOC::Service::WithAcceptContext'; +with 'Catalyst::IOC::Service::WithParameters', + 'Bread::Board::Service::WithDependencies'; __PACKAGE__->meta->make_immutable; diff --git a/lib/Catalyst/IOC/ConstructorInjection.pm b/lib/Catalyst/IOC/ConstructorInjection.pm index 72e1543..711f2f2 100644 --- a/lib/Catalyst/IOC/ConstructorInjection.pm +++ b/lib/Catalyst/IOC/ConstructorInjection.pm @@ -4,8 +4,8 @@ use Catalyst::Utils (); extends 'Bread::Board::ConstructorInjection'; with 'Bread::Board::Service::WithClass', - 'Bread::Board::Service::WithDependencies', 'Bread::Board::Service::WithParameters', + 'Bread::Board::Service::WithDependencies', 'Catalyst::IOC::Service::WithCOMPONENT'; has config_key => ( diff --git a/lib/Catalyst/IOC/Service/WithAcceptContext.pm b/lib/Catalyst/IOC/Service/WithAcceptContext.pm index afc810f..eb0ff39 100644 --- a/lib/Catalyst/IOC/Service/WithAcceptContext.pm +++ b/lib/Catalyst/IOC/Service/WithAcceptContext.pm @@ -1,8 +1,6 @@ package Catalyst::IOC::Service::WithAcceptContext; use Moose::Role; -with 'Bread::Board::Service'; - has accept_context_sub => ( is => 'ro', isa => 'Str', @@ -12,13 +10,12 @@ has accept_context_sub => ( around get => sub { my $orig = shift; my $self = shift; - my %params = @_; - - my $instance = $self->$orig(@_); - my $accept_context_args = $params{accept_context_args}; + my $accept_context_args = $self->param('accept_context_args'); my $ac_sub = $self->accept_context_sub; + my $instance = $self->$orig(@_); + if ( $instance->can($ac_sub) ) { return $instance->$ac_sub( @$accept_context_args ); }