Skip to content

Instantly share code, notes, and snippets.

/helper.diff Secret

Created August 18, 2014 22:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4e1944be44244056e89f to your computer and use it in GitHub Desktop.
Save anonymous/4e1944be44244056e89f to your computer and use it in GitHub Desktop.
diff --git a/lib/Mojolicious/Routes.pm b/lib/Mojolicious/Routes.pm
index e98b44c..eb81fe6 100644
--- a/lib/Mojolicious/Routes.pm
+++ b/lib/Mojolicious/Routes.pm
@@ -114,8 +114,17 @@ sub _add {
sub _callback {
my ($self, $c, $cb, $last) = @_;
$c->stash->{'mojo.routed'}++ if $last;
+
+ # Callback
my $app = $c->app;
- $app->log->debug('Routing to a callback.');
+ if (ref $cb) { $app->log->debug('Routing to a callback.') }
+
+ # Helper
+ else {
+ $app->log->debug(qq{Routing to helper "$cb".});
+ return undef unless $cb = $app->renderer->get_helper($cb);
+ }
+
return _action($app, $c, $cb, $last);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment