line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sort::Sub::naturally; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2020-02-28'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'Sort-Sub'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.118'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
35
|
use 5.010; |
|
2
|
|
|
|
|
6
|
|
9
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
54
|
|
10
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
151
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub meta { |
13
|
|
|
|
|
|
|
return { |
14
|
0
|
|
|
0
|
0
|
0
|
v => 1, |
15
|
|
|
|
|
|
|
summary => 'Sort naturally (by number or string parts)', |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub gen_sorter { |
20
|
5
|
|
|
5
|
0
|
1070
|
require Sort::Naturally; |
21
|
|
|
|
|
|
|
|
22
|
5
|
|
|
|
|
8670
|
my ($is_reverse, $is_ci) = @_; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub { |
25
|
2
|
|
|
2
|
|
23
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
343
|
|
26
|
|
|
|
|
|
|
|
27
|
15
|
|
|
15
|
|
359
|
my $caller = caller(); |
28
|
15
|
100
|
|
|
|
30
|
my $a = @_ ? $_[0] : ${"$caller\::a"}; |
|
9
|
|
|
|
|
18
|
|
29
|
15
|
100
|
|
|
|
23
|
my $b = @_ ? $_[1] : ${"$caller\::b"}; |
|
9
|
|
|
|
|
17
|
|
30
|
|
|
|
|
|
|
|
31
|
15
|
100
|
|
|
|
23
|
if ($is_reverse) { |
32
|
3
|
|
|
|
|
74
|
Sort::Naturally::ncmp($b, $a); |
33
|
|
|
|
|
|
|
} else { |
34
|
12
|
|
|
|
|
222
|
Sort::Naturally::ncmp($a, $b); |
35
|
|
|
|
|
|
|
} |
36
|
5
|
|
|
|
|
27
|
}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
# ABSTRACT: Sort naturally (by number or string parts) |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |