X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FActionChain.pm;h=6b08e2b107eded5c2eb8e25dca79b3737453cfa2;hb=d666af81cece84d49c57bb91949641937ad57091;hp=2bcc31fb3c1b507ea41d3cf965ad08e519c5190a;hpb=141459fa3fc9852fd6f05138caddb410bbe2949c;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/ActionChain.pm b/lib/Catalyst/ActionChain.pm index 2bcc31f..6b08e2b 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->{Captures}) { + @args = splice(@captures, 0, $cap->[0]); + } + local $c->request->{arguments} = \@args; $action->dispatch( $c ); } + $last->dispatch( $c ); } =head2 from_chain( \@actions )