line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Sort::Sub::prereq_ala_perlancar; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2019-12-15'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'PERLANCAR-Sort-Sub'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.07'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1963
|
use 5.010001; |
|
1
|
|
|
|
|
4
|
|
9
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
10
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
66
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub meta { |
13
|
|
|
|
|
|
|
return { |
14
|
0
|
|
|
0
|
0
|
0
|
v => 1, |
15
|
|
|
|
|
|
|
summary => 'Sort prereqs PERLANCAR-style', |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub gen_sorter { |
20
|
3
|
|
|
3
|
0
|
1533
|
my ($is_reverse, $is_ci) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub { |
23
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
237
|
|
24
|
|
|
|
|
|
|
|
25
|
31
|
|
|
31
|
|
279
|
my $caller = caller(); |
26
|
31
|
50
|
|
|
|
51
|
my $a = @_ ? $_[0] : ${"$caller\::a"}; |
|
31
|
|
|
|
|
71
|
|
27
|
31
|
50
|
|
|
|
54
|
my $b = @_ ? $_[1] : ${"$caller\::b"}; |
|
31
|
|
|
|
|
61
|
|
28
|
|
|
|
|
|
|
|
29
|
31
|
|
|
|
|
38
|
my $cmp = 0; |
30
|
|
|
|
|
|
|
{ |
31
|
31
|
100
|
|
|
|
41
|
my $a_is_perl = $a eq 'perl' ? 1:0; |
|
31
|
|
|
|
|
51
|
|
32
|
31
|
100
|
|
|
|
47
|
my $b_is_perl = $b eq 'perl' ? 1:0; |
33
|
|
|
|
|
|
|
|
34
|
31
|
100
|
|
|
|
74
|
my $a_is_pragma = $a =~ /\A[a-z]/ ? 1:0; |
35
|
31
|
100
|
|
|
|
59
|
my $b_is_pragma = $b =~ /\A[a-z]/ ? 1:0; |
36
|
|
|
|
|
|
|
|
37
|
31
|
|
66
|
|
|
224
|
$cmp = |
38
|
|
|
|
|
|
|
($b_is_perl <=> $a_is_perl) || |
39
|
|
|
|
|
|
|
($b_is_pragma <=> $a_is_pragma) || |
40
|
|
|
|
|
|
|
lc($a) cmp lc($b); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
31
|
100
|
|
|
|
76
|
$is_reverse ? -1*$cmp : $cmp; |
44
|
3
|
|
|
|
|
16
|
}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
# ABSTRACT: Sort prereqs PERLANCAR-style |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |