Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
slightly better loader
  • Loading branch information
kraih committed Aug 21, 2011
1 parent 5bb1ee9 commit 2733ca0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/Mojo/Command.pm
Expand Up @@ -232,12 +232,8 @@ sub run {
my $commands = [];
my $seen = {};
for my $namespace (@{$self->namespaces}) {

# Search
for my $module (@{Mojo::Loader->search($namespace)}) {
if (my $e = Mojo::Loader->load($module)) { die $e }
next unless $module->can('new') && $module->can('description');
my $command = $module;
next unless my $command = _command($module);
$command =~ s/^$namespace\:://;
push @$commands, [$command => $module]
unless $seen->{$command};
Expand Down Expand Up @@ -310,7 +306,7 @@ sub _command {
return unless ref $e;
die $e;
}
return unless $module->can('new') && $module->can('run');
return unless $module->can('new') && $module->isa('Mojo::Command');

return $module;
}
Expand Down

0 comments on commit 2733ca0

Please sign in to comment.