probably sorted capture passing to non-leaf actions
[catagits/Catalyst-Runtime.git] / lib / Catalyst / ActionChain.pm
index 2bcc31f..ceb7c81 100644 (file)
@@ -48,7 +48,13 @@ actions in order.
 
 sub dispatch {
     my ( $self, $c ) = @_;
+    my @captures = @{$c->req->captures||[]};
     foreach my $action ( @{ $self->chain } ) {
+        my @args;
+        if (my $cap = $action->attributes->{Captures}) {
+          @args = splice(@captures, 0, $cap->[0]);
+        }
+        local $c->request->{arguments} = \@args;
         $action->dispatch( $c );
     }
 }