Skip to content

Commit

Permalink
use a little less code
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 10, 2014
1 parent 04b1268 commit 7ff69de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 1 addition & 3 deletions lib/Mojolicious/Plugin/Mount.pm
Expand Up @@ -17,9 +17,7 @@ sub register {
}

my $route = $app->routes->route($path)->detour(app => $embed);
$route->over(host => $host) if $host;

return $route;
return $host ? $route->over(host => $host) : $route;
}

1;
Expand Down
5 changes: 1 addition & 4 deletions lib/Mojolicious/Plugins.pm
Expand Up @@ -34,10 +34,7 @@ sub load_plugin {

# Try all namespaces
my $class = $name =~ /^[a-z]/ ? camelize($name) : $name;
for my $ns (@{$self->namespaces}) {
my $module = "${ns}::$class";
return $module->new if _load($module);
}
_load($_) and return $_->new for map {"$_::$class"} @{$self->namespaces};

# Full module name
return $name->new if _load($name);
Expand Down

0 comments on commit 7ff69de

Please sign in to comment.