Subject: | [PATCH] correct number of capture args for chained dispatches |
Hi,
I was having problems with tabs not showing up for some chained actions
in my controller and I followed it back to the sub that builds the tabs.
It seems the capture args from the request are being passed into each
action, irrespective of how many capture args that particular action
expects.
I've patched this in my local version (see attached) and this works for
my case - I haven't tested with other dispatch types but I figured you
might be interested.
Cheers,
Ian
Subject: | catalyst-actionrole-tabs-correct-capture-args.patch |
--- lib/Catalyst/ActionRole/Tabs.pm (revision 14514)
+++ lib/Catalyst/ActionRole/Tabs.pm (working copy)
@@ -252,10 +252,18 @@
}
for (keys %t) {
($action, $name) = @{$t{$_}};
+
+ # use the correct number of captures for chained actions
+ my $action_chain = $dispatcher->expand_action( $action );
+ my $number_of_captures_for_action = $action_chain->number_of_captures;
+ my @action_captures = $number_of_captures_for_action
+ ? @$request_captures[ 0 .. ($number_of_captures_for_action - 1) ]
+ : ();
+
# get all URIs for the current namespace and request captures
$uri = $c->uri_for(
$action,
- $request_captures,
+ \@action_captures,
@$request_arguments
)
or next;