Sort-Sub
view release on metacpan or search on metacpan
0.111 2019-10-26 Released-By: PERLANCAR; Urgency: medium
- Allow passing arguments to gen_sorter().
- Add sorter: by_count.
0.110 2018-01-15 Released-By: PERLANCAR
- naturally: Use Sort::Naturally instead of using our own algorithm
(better handles more cases). As a consequence, we are now always
case-insensitive since Sort::Naturally is.
0.10 2016-12-18 Released-By: PERLANCAR
- [Incompatible change] Rename modules to by_* to be consistent
with the convention.
0.09 2016-12-18 Released-By: PERLANCAR
"Test::Pod::Coverage" : "1.08"
}
},
"runtime" : {
"requires" : {
"Complete::Sah" : "0.012",
"Complete::Sequence" : "0.002",
"Complete::Util" : "0.620",
"Exporter" : "5.57",
"Log::ger" : "0.038",
"Sort::Naturally" : "0",
"Test::More" : "0.98",
"parent" : "0",
"perl" : "5.010001",
"strict" : "0",
"warnings" : "0"
}
},
"test" : {
"requires" : {
"File::Spec" : "0",
version: '0.121'
Test::Sort::Sub:
file: lib/Test/Sort/Sub.pm
version: '0.121'
requires:
Complete::Sah: '0.012'
Complete::Sequence: '0.002'
Complete::Util: '0.620'
Exporter: '5.57'
Log::ger: '0.038'
Sort::Naturally: '0'
Test::More: '0.98'
parent: '0'
perl: '5.010001'
strict: '0'
warnings: '0'
resources:
bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Sort-Sub
homepage: https://metacpan.org/release/Sort-Sub
repository: git://github.com/perlancar/perl-Sort-Sub.git
version: '0.121'
Makefile.PL view on Meta::CPAN
"DISTNAME" => "Sort-Sub",
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.010001",
"NAME" => "Sort::Sub",
"PREREQ_PM" => {
"Complete::Sah" => "0.012",
"Complete::Sequence" => "0.002",
"Complete::Util" => "0.620",
"Exporter" => "5.57",
"Log::ger" => "0.038",
"Sort::Naturally" => 0,
"Test::More" => "0.98",
"parent" => 0,
"strict" => 0,
"warnings" => 0
},
"TEST_REQUIRES" => {
"File::Spec" => 0,
"IO::Handle" => 0,
"IPC::Open3" => 0,
"Test::More" => "0.98"
Makefile.PL view on Meta::CPAN
my %FallbackPrereqs = (
"Complete::Sah" => "0.012",
"Complete::Sequence" => "0.002",
"Complete::Util" => "0.620",
"Exporter" => "5.57",
"File::Spec" => 0,
"IO::Handle" => 0,
"IPC::Open3" => 0,
"Log::ger" => "0.038",
"Sort::Naturally" => 0,
"Test::More" => "0.98",
"parent" => 0,
"strict" => 0,
"warnings" => 0
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
delete $WriteMakefileArgs{BUILD_REQUIRES};
[Prereqs]
perl=5.010001
parent=0
strict=0
warnings=0
Complete::Sah=0.012
Complete::Sequence=0.002
Complete::Util=0.620
Exporter=5.57
Log::ger=0.038
Sort::Naturally=0
Test::More=0.98
lib/Sort/Sub/by_count.pm view on Meta::CPAN
Please visit the project's homepage at L<https://metacpan.org/release/Sort-Sub>.
=head1 SOURCE
Source repository is at L<https://github.com/perlancar/perl-Sort-Sub>.
=head1 SEE ALSO
L<Sort::Sub>
L<Sort::Naturally>
=head1 AUTHOR
perlancar <perlancar@cpan.org>
=head1 CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull requests on
GitHub.
lib/Sort/Sub/naturally.pm view on Meta::CPAN
our $VERSION = '0.121'; # VERSION
sub meta {
return {
v => 1,
summary => 'Sort naturally (by number or string parts)',
};
}
sub gen_sorter {
require Sort::Naturally;
my ($is_reverse, $is_ci) = @_;
sub {
no strict 'refs'; ## no critic: TestingAndDebugging::ProhibitNoStrict
my $caller = caller();
my $a = @_ ? $_[0] : ${"$caller\::a"};
my $b = @_ ? $_[1] : ${"$caller\::b"};
if ($is_reverse) {
Sort::Naturally::ncmp($b, $a);
} else {
Sort::Naturally::ncmp($a, $b);
}
};
}
1;
# ABSTRACT: Sort naturally (by number or string parts)
__END__
=pod
lib/Sort/Sub/naturally.pm view on Meta::CPAN
% some-cmd | sortsub naturally
% some-cmd | sortsub naturally --ignore-case -r
=head1 DESCRIPTION
This module can generate sort subroutine. It is meant to be used via L<Sort::Sub>, although you can also use it directly via C<gen_sorter()>.
=head1 NOTES
Uses L<Sort::Naturally>'s C<ncmp> as the backend. Always sorts
case-insensitively.
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/Sort-Sub>.
=head1 SOURCE
Source repository is at L<https://github.com/perlancar/perl-Sort-Sub>.
=head1 SEE ALSO
L<Sort::Sub>
L<Sort::Naturally>
=head1 AUTHOR
perlancar <perlancar@cpan.org>
=head1 CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull requests on
GitHub.
( run in 1.004 second using v1.01-cache-2.11-cpan-56fb94df46f )