App-perlimports
view release on metacpan or search on metacpan
lib/App/perlimports/Include.pm view on Meta::CPAN
## no critic (BuiltinFunctions::RequireSimpleSortBlock)
my @sorted = sort {
my $A = _transform_before_cmp($a);
my $B = _transform_before_cmp($b);
"\L$A" cmp "\L$B";
} @list;
return @sorted;
}
# This looks a little weird, but basically we want to maintain a stable sort
# order with lists that look like (foo, $foo, @foo, %foo). We use "-" to begin
# the suffix because it comes earliest in a sorted list of letters and digits.
sub _transform_before_cmp {
my $thing = shift;
if ( $thing =~ m{\A[\$]} ) {
$thing = substr( $thing, 1 ) . '-0';
}
elsif ( $thing =~ m{\A[@]} ) {
$thing = substr( $thing, 1 ) . '-1';
}
( run in 0.307 second using v1.01-cache-2.11-cpan-607d282f910 )