Skip to content

Commit

Permalink
small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 18, 2013
1 parent 5f13e39 commit 94f74da
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,4 +1,6 @@

4.16 2013-06-19

4.15 2013-06-18
- Added around_action hook.
- Improved ojo to make the current controller object available to actions
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious.pm
Expand Up @@ -41,7 +41,7 @@ has static => sub { Mojolicious::Static->new };
has types => sub { Mojolicious::Types->new };

our $CODENAME = 'Top Hat';
our $VERSION = '4.15';
our $VERSION = '4.16';

sub AUTOLOAD {
my $self = shift;
Expand Down
12 changes: 6 additions & 6 deletions lib/Mojolicious/Routes.pm
Expand Up @@ -93,11 +93,11 @@ sub _add {
}

sub _callback {
my ($self, $c, $field, $nested) = @_;
my ($self, $c, $field, $last) = @_;
$c->stash->{'mojo.routed'}++;
my $app = $c->app;
$app->log->debug('Routing to a callback.');
return _action($app, $c, $field->{cb}, $nested) || $nested;
return _action($app, $c, $field->{cb}, $last);
}

sub _class {
Expand Down Expand Up @@ -141,7 +141,7 @@ sub _class {
}

sub _controller {
my ($self, $old, $field, $nested) = @_;
my ($self, $old, $field, $last) = @_;

# Load and instantiate controller/application
my $new;
Expand Down Expand Up @@ -169,16 +169,16 @@ sub _controller {
$log->debug(qq{Routing to controller "$class" and action "$method".});

if (my $sub = $new->can($method)) {
$old->stash->{'mojo.routed'}++ if $nested;
return 1 if _action($app, $new, $sub, $nested);
$old->stash->{'mojo.routed'}++ if $last;
return 1 if _action($app, $new, $sub, $last);
}

else { $log->debug('Action not found in controller.') }
}
else { $log->debug(qq{Action "$method" is not allowed.}) }
}

return $nested;
return undef;
}

sub _load {
Expand Down

0 comments on commit 94f74da

Please sign in to comment.