X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FActionChain.pm;h=6d161045f636a9561efe5d3bff3f8f786e95caf1;hp=2bcc31fb3c1b507ea41d3cf965ad08e519c5190a;hb=1c34f703cbd82cddceea95593001a579e1d5f646;hpb=141459fa3fc9852fd6f05138caddb410bbe2949c diff --git a/lib/Catalyst/ActionChain.pm b/lib/Catalyst/ActionChain.pm index 2bcc31f..6d16104 100644 --- a/lib/Catalyst/ActionChain.pm +++ b/lib/Catalyst/ActionChain.pm @@ -48,9 +48,18 @@ actions in order. sub dispatch { my ( $self, $c ) = @_; - foreach my $action ( @{ $self->chain } ) { + my @captures = @{$c->req->captures||[]}; + my @chain = @{ $self->chain }; + my $last = pop(@chain); + foreach my $action ( @chain ) { + my @args; + if (my $cap = $action->attributes->{CaptureArgs}) { + @args = splice(@captures, 0, $cap->[0]); + } + local $c->request->{arguments} = \@args; $action->dispatch( $c ); } + $last->dispatch( $c ); } =head2 from_chain( \@actions )