Skip to content

Commit

Permalink
Avoid using $_ when loading the commands from namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrtj committed May 17, 2024
1 parent 431cc0a commit 0912572
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Mojolicious/Commands.pm
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ sub run {
# Find all available commands
my %all;
for my $ns (@{$self->namespaces}) {
$all{substr $_, length "${ns}::"} //= $_->new->description
for grep { _command($_) } find_modules($ns), find_packages($ns);
for my $pkg (find_modules($ns), find_packages($ns)) {
next unless _command($pkg);
$all{substr $pkg, length "${ns}::"} //= $pkg->new->description
}
}

my @rows;
Expand Down Expand Up @@ -323,3 +325,4 @@ C<--home> and C<-m>/C<--mode>, which are shared by all commands, will be parsed
L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>.
=cut

0 comments on commit 0912572

Please sign in to comment.