From: Tomas Doran Date: Mon, 26 Dec 2011 23:24:34 +0000 (+0000) Subject: Deal with param passing X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;p=catagits%2FCatalystX-UriFor-Curried.git Deal with param passing --- diff --git a/lib/CatalystX/UriFor/Curried.pm b/lib/CatalystX/UriFor/Curried.pm index e8e5db5..006f7c6 100644 --- a/lib/CatalystX/UriFor/Curried.pm +++ b/lib/CatalystX/UriFor/Curried.pm @@ -25,12 +25,13 @@ role { my ($ctx, $action_or_private_path, $captures, @args) = @_; my $weak_ctx = $ctx; # Just for safety so it can't be closed over. weaken($weak_ctx); + my $params = ref($args[-1]) eq 'HASH' ? pop(@args) : {}; if (ref($captures) eq 'ARRAY' || (!$captures && !scalar(@args))) { # FIXME BUG IN THIS LOGIC $captures ||= []; foreach my $name_or_sub ($stash_captures->flatten) { unshift(@$captures, ref($name_or_sub) eq 'CODE' ? $name_or_sub->($weak_ctx) : $ctx->stash->{$name_or_sub}); } - $ctx->uri_for_action($action_or_private_path, $captures, @args); + $ctx->uri_for_action($action_or_private_path, $captures, @args, $params); } };