As that's undefined behavior if the containing sub is called in
scalar context.
https://metacpan.org/pod/Perl::Critic::Policy::Subroutines::ProhibitReturnSort
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
print {$fd} generate_usage_str('short', $cmd, ' ' x 7, $cmd ? '' : "\n", sub {
my ($h) = @_;
- return sort {
+ my @sorted_commands = sort {
if (ref($h->{$a}) eq 'ARRAY' && ref($h->{$b}) eq 'ARRAY') {
# $a and $b are both real commands order them by their class
return $h->{$a}->[0] cmp $h->{$b}->[0] || $a cmp $b;
return $a cmp $b;
}
} keys %$h;
+ return @sorted_commands;
});
}