Skip to content

Commit

Permalink
localize placeholder values and merge early again
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 11, 2014
1 parent f5b6b08 commit 175cc94
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/Mojolicious/Routes/Match.pm
Expand Up @@ -44,6 +44,8 @@ sub _match {
my $detect = (my $endpoint = $r->is_endpoint) && !$partial;
return unless my $captures = $r->pattern->match_partial(\$path, $detect);
local $options->{path} = $path;
local @{$self->{captures} ||= {}}{keys %$captures} = values %$captures;
$captures = $self->{captures};
# Method
my $methods = $r->via;
Expand All @@ -61,10 +63,6 @@ sub _match {
# WebSocket
return if $r->is_websocket && !$options->{websocket};
# Merge after everything matched
@{$self->{captures} ||= {}}{keys %$captures} = values %$captures;
$captures = $self->{captures};
# Partial
my $empty = !length $path || $path eq '/';
if ($partial) {
Expand Down

0 comments on commit 175cc94

Please sign in to comment.