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 )