Skip to content

Commit 32871e0

Browse files
committed
Avoid using $_ when loading the commands from namespaces
resolves #2175
1 parent ecb44cf commit 32871e0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/Mojolicious/Commands.pm

+4-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ sub run {
6565
# Find all available commands
6666
my %all;
6767
for my $ns (@{$self->namespaces}) {
68-
$all{substr $_, length "${ns}::"} //= $_->new->description
69-
for grep { _command($_) } find_modules($ns), find_packages($ns);
68+
for my $pkg (find_modules($ns), find_packages($ns)) {
69+
next unless _command($pkg);
70+
$all{substr $pkg, length "${ns}::"} //= $pkg->new->description;
71+
}
7072
}
7173

7274
my @rows;

0 commit comments

Comments
 (0)