my @captures = @$captures;
my $parent = "DUMMY";
my $curr = $action;
+ # If this is an action chain get the last action in the chain
+ if($curr->can('chain') ) {
+ $curr = ${$curr->chain}[-1];
+ }
while ($curr) {
- if (my $cap = $curr->attributes->{CaptureArgs}) {
- return undef unless @captures >= ($cap->[0]||0); # not enough captures
- if ($cap->[0]) {
- unshift(@parts, splice(@captures, -$cap->[0]));
+ if (my $cap = $curr->number_of_captures) {
+ return undef unless @captures >= $cap; # not enough captures
+ if ($cap) {
+ unshift(@parts, splice(@captures, -$cap));
}
}
if (my $pp = $curr->attributes->{PathPart}) {
sub int_priority_link3 :Chained(link_tuple) PathPart('') Args(Int) { $_[1]->res->body('int_priority_link3') }
+ sub link2_int :Chained(link_tuple) PathPart('') CaptureArgs(UserId) { }
+
+ sub finally :Chained(link2_int) PathPart('') Args(Int) { $_[1]->res->body('finally') }
sub default :Default {
my ($self, $c, $int) = @_;
is $res->content, 'default';
}
-#{
- # URI testing
- #my ($res, $c) = ctx_request '/';
+=over
+| /chain_base/*/*/*/*/*/* | /chain_base (1) |
+| | -> /link_tuple (3) |
+| | -> /link2_int (1) |
+| | => /finally (missing...) |
-#}
+=cut
+
+{
+ # URI testing
+ my ($res, $c) = ctx_request '/';
+ ok my $url1 = $c->uri_for($c->controller('Root')->action_for('finally'), [1,2,3,4,5],6);
+ warn $url1;
+
+ ok my $url2 = $c->uri_for($c->controller('Root')->action_for('finally'), [1,2,3,4,5,6]);
+ warn $url2;
+}
done_testing;