ACCEPT_CONTEXT wasnt getting the args
André Walker [Tue, 2 Aug 2011 01:06:46 +0000 (22:06 -0300)]
lib/Catalyst/IOC/Service/WithAcceptContext.pm
lib/Catalyst/IOC/Service/WithParameters.pm

index 4559a69..afc810f 100644 (file)
@@ -9,13 +9,14 @@ has accept_context_sub => (
     default => 'ACCEPT_CONTEXT',
 );
 
-around 'get' => sub {
-    my $orig = shift;
-    my $self = shift;
+around get => sub {
+    my $orig   = shift;
+    my $self   = shift;
+    my %params = @_;
 
     my $instance = $self->$orig(@_);
 
-    my $accept_context_args = $self->param('accept_context_args');
+    my $accept_context_args = $params{accept_context_args};
     my $ac_sub = $self->accept_context_sub;
 
     if ( $instance->can($ac_sub) ) {
index 44c42f9..7abe5ac 100644 (file)
@@ -1,15 +1,13 @@
 package Catalyst::IOC::Service::WithParameters;
 use Moose::Role;
 
-with 'Bread::Board::Service',
-     'Bread::Board::Service::WithParameters';
+with 'Bread::Board::Service::WithParameters' => { excludes => '_build_parameters' };
 
 sub _build_parameters {
     return {
         accept_context_args => {
-            isa      => 'ArrayRef|Undef',
-            required => 0,
-            default  => undef,
+            isa      => 'ArrayRef',
+            required => 1,
         }
     };
 }