File Coverage

blib/lib/Sort/Sub/by_first_num_in_text.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 11 11 100.0


line stmt bran cond sub pod time code
1             package Sort::Sub::by_first_num_in_text;
2              
3             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
4             our $DATE = '2020-02-28'; # DATE
5             our $DIST = 'Sort-Sub'; # DIST
6             our $VERSION = '0.117'; # VERSION
7              
8 1     1   16 use 5.010001;
  1         3  
9 1     1   4 use strict;
  1         1  
  1         17  
10 1     1   4 use warnings;
  1         1  
  1         57  
11             require Sort::Sub::by_num_in_text;
12             *gen_sorter = \&Sort::Sub::by_num_in_text::gen_sorter;
13             *meta = \&Sort::Sub::by_num_in_text::meta;
14              
15             1;
16             # ABSTRACT: Sort by first number found in text or (if no number is found) ascibetically
17              
18             __END__
19              
20             =pod
21              
22             =encoding UTF-8
23              
24             =head1 NAME
25              
26             Sort::Sub::by_first_num_in_text - Sort by first number found in text or (if no number is found) ascibetically
27              
28             =head1 VERSION
29              
30             This document describes version 0.117 of Sort::Sub::by_first_num_in_text (from Perl distribution Sort-Sub), released on 2020-02-28.
31              
32             =for Pod::Coverage ^(gen_sorter|meta)$
33              
34             =head1 SYNOPSIS
35              
36             Generate sorter (accessed as variable) via L<Sort::Sub> import:
37              
38             use Sort::Sub '$by_first_num_in_text'; # use '$by_first_num_in_text<i>' for case-insensitive sorting, '$by_first_num_in_text<r>' for reverse sorting
39             my @sorted = sort $by_first_num_in_text ('item', ...);
40              
41             Generate sorter (accessed as subroutine):
42              
43             use Sort::Sub 'by_first_num_in_text<ir>';
44             my @sorted = sort {by_first_num_in_text} ('item', ...);
45              
46             Generate directly without Sort::Sub:
47              
48             use Sort::Sub::by_first_num_in_text;
49             my $sorter = Sort::Sub::by_first_num_in_text::gen_sorter(
50             ci => 1, # default 0, set 1 to sort case-insensitively
51             reverse => 1, # default 0, set 1 to sort in reverse order
52             );
53             my @sorted = sort $sorter ('item', ...);
54              
55             Use in shell/CLI with L<sortsub> (from L<App::sortsub>):
56              
57             % some-cmd | sortsub by_first_num_in_text
58             % some-cmd | sortsub by_first_num_in_text --ignore-case -r
59              
60             =head1 DESCRIPTION
61              
62             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()>.
63              
64             =head1 HOMEPAGE
65              
66             Please visit the project's homepage at L<https://metacpan.org/release/Sort-Sub>.
67              
68             =head1 SOURCE
69              
70             Source repository is at L<https://github.com/perlancar/perl-Sort-Sub>.
71              
72             =head1 BUGS
73              
74             Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Sort-Sub>
75              
76             When submitting a bug or request, please include a test-file or a
77             patch to an existing test-file that illustrates the bug or desired
78             feature.
79              
80             =head1 SEE ALSO
81              
82             L<Sort::Sub>
83              
84             L<Sort::Sub::by_num_in_text>
85              
86             =head1 AUTHOR
87              
88             perlancar <perlancar@cpan.org>
89              
90             =head1 COPYRIGHT AND LICENSE
91              
92             This software is copyright (c) 2020, 2019, 2018, 2016, 2015 by perlancar@cpan.org.
93              
94             This is free software; you can redistribute it and/or modify it under
95             the same terms as the Perl 5 programming language system itself.
96              
97             =cut