From: Gareth Kirwan Date: Mon, 21 Sep 2009 14:05:17 +0000 (+0000) Subject: - Fix go / visit expecting captures and arguments in reverse order. X-Git-Tag: 5.80014~43 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=e1e81442ef3eb71e01ef4a9afb6aedfd2f3418da - Fix go / visit expecting captures and arguments in reverse order. --- diff --git a/Changes b/Changes index 479164f..3ad01ee 100644 --- a/Changes +++ b/Changes @@ -10,6 +10,7 @@ method. - Require new Moose version and new versions of various dependencies to avoid warnings from newest Moose release. + - Fix go / visit expecting captures and arguments in reverse order. Documentation: - Rework the $c->go documentation to make it more clear. diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index 3d6573b..93c0d93 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -131,7 +131,7 @@ sub _command2action { my (@args, @captures); if ( ref( $extra_params[-2] ) eq 'ARRAY' ) { - @captures = @{ pop @extra_params }; + @captures = @{ splice @extra_params, -2, 1 }; } if ( ref( $extra_params[-1] ) eq 'ARRAY' ) { diff --git a/t/aggregate/live_component_controller_action_go.t b/t/aggregate/live_component_controller_action_go.t index 41b09b6..8554f72 100644 --- a/t/aggregate/live_component_controller_action_go.t +++ b/t/aggregate/live_component_controller_action_go.t @@ -262,7 +262,7 @@ sub run_tests { ok( my $response = request('http://localhost/action/go/go_chained'), 'go to chained + subcontroller endpoint' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); - is( $response->content, 'arg1, arg2; captureme', 'Content OK' ); + is( $response->content, 'captureme; arg1, arg2', 'Content OK' ); } } diff --git a/t/aggregate/live_component_controller_action_visit.t b/t/aggregate/live_component_controller_action_visit.t index 4bd246d..b331e7c 100644 --- a/t/aggregate/live_component_controller_action_visit.t +++ b/t/aggregate/live_component_controller_action_visit.t @@ -276,7 +276,7 @@ sub run_tests { "visit to chained + subcontroller endpoint for $i" ); is( $response->header('X-Catalyst-Executed'), $expected, "Executed actions for $i" ); - is( $response->content, "arg1, arg2; becomescapture", + is( $response->content, "becomescapture; arg1, arg2", "Content OK for $i" ); } }