line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Build::Plugin::Prefer::SortVersions; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
1382
|
use strict; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
124
|
|
4
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
93
|
|
5
|
4
|
|
|
4
|
|
62
|
use 5.008004; |
|
4
|
|
|
|
|
15
|
|
6
|
4
|
|
|
4
|
|
452
|
use Alien::Build::Plugin; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
32
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: Plugin to sort candidates by most recent first |
9
|
|
|
|
|
|
|
our $VERSION = '2.46'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has 'filter' => undef; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has '+version' => qr/([0-9](?:[0-9\.]*[0-9])?)/; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub init |
18
|
|
|
|
|
|
|
{ |
19
|
7
|
|
|
7
|
1
|
30
|
my($self, $meta) = @_; |
20
|
|
|
|
|
|
|
|
21
|
7
|
|
|
|
|
25
|
$meta->add_requires('share' => 'Sort::Versions' => 0); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
$meta->register_hook( prefer => sub { |
24
|
0
|
|
|
0
|
|
|
my(undef, $res) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $cmp = sub { |
27
|
0
|
|
|
|
|
|
my($A,$B) = map { ($_ =~ $self->version)[0] } @_; |
|
0
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
Sort::Versions::versioncmp($B,$A); |
29
|
0
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my @list = sort { $cmp->($a->{filename}, $b->{filename}) } |
32
|
|
|
|
|
|
|
map { |
33
|
0
|
|
|
|
|
|
($_->{version}) = $_->{filename} =~ $self->version; |
34
|
0
|
|
|
|
|
|
$_ } |
35
|
0
|
|
|
|
|
|
grep { $_->{filename} =~ $self->version } |
36
|
0
|
0
|
|
|
|
|
grep { defined $self->filter ? $_->{filename} =~ $self->filter : 1 } |
37
|
0
|
|
|
|
|
|
@{ $res->{list} }; |
|
0
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
return { |
40
|
0
|
|
|
|
|
|
type => 'list', |
41
|
|
|
|
|
|
|
list => \@list, |
42
|
|
|
|
|
|
|
}; |
43
|
7
|
|
|
|
|
51
|
}); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |