Skip to content

Commit

Permalink
fixed small condition bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 20, 2012
1 parent b0bf1ed commit 45232f4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -10,6 +10,7 @@ This file documents the revision history for Perl extension Mojolicious.
- Improved tests.
- Fixed bug that slowed down Mojolicious::Renderer.
- Fixed small newline capture bug in Mojolicious::Routes::Match.
- Fixed small condition bug.

2.62 2012-03-17 00:00:00
- Deprecated Mojolicious::Renderer->default_template_class in favor
Expand Down
3 changes: 1 addition & 2 deletions lib/Mojolicious/Routes/Match.pm
Expand Up @@ -28,7 +28,6 @@ sub new {
# "Life can be hilariously cruel."
sub match {
my ($self, $r, $c) = @_;
return unless $r;

# Match
$self->root($r) unless $self->root;
Expand All @@ -46,7 +45,7 @@ sub match {

# Conditions
my $conditions = $r->conditions;
my $dictionary = $self->{dictionary} ||= $r->dictionary;
my $dictionary = $r->dictionary;
for (my $i = 0; $i < @$conditions; $i += 2) {
return unless my $condition = $dictionary->{$conditions->[$i]};
return if !$condition->($r, $c, $captures, $conditions->[$i + 1]);
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Routes/Route.pm
Expand Up @@ -33,7 +33,7 @@ sub new { shift->SUPER::new->parse(@_) }
sub add_child {
my ($self, $route) = @_;
weaken $route->parent($self)->{parent};
$route->shortcuts($self->shortcuts);
$route->dictionary($self->dictionary)->shortcuts($self->shortcuts);
push @{$self->children}, $route;
return $self;
}
Expand Down

0 comments on commit 45232f4

Please sign in to comment.