| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Alien::Build::Plugin::Prefer::BadVersion; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1842
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
60
|
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
59
|
|
|
5
|
2
|
|
|
2
|
|
42
|
use 5.008004; |
|
|
2
|
|
|
|
|
6
|
|
|
6
|
2
|
|
|
2
|
|
364
|
use Alien::Build::Plugin; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
15
|
|
|
7
|
2
|
|
|
2
|
|
12
|
use Carp (); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
738
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Plugin to filter out known bad versions |
|
10
|
|
|
|
|
|
|
our $VERSION = '2.47'; # VERSION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has '+filter' => sub { Carp::croak("The filter property is required for the Prefer::BadVersion plugin") }; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub init |
|
16
|
|
|
|
|
|
|
{ |
|
17
|
0
|
|
|
0
|
1
|
|
my($self, $meta) = @_; |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
$meta->add_requires('configure', __PACKAGE__, '1.05'); |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $filter; |
|
22
|
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
if(ref($self->filter) eq '') |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
{ |
|
25
|
0
|
|
|
|
|
|
my $string = $self->filter; |
|
26
|
|
|
|
|
|
|
$filter = sub { |
|
27
|
0
|
|
|
0
|
|
|
my($file) = @_; |
|
28
|
0
|
|
|
|
|
|
$file->{version} ne $string; |
|
29
|
0
|
|
|
|
|
|
}; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
elsif(ref($self->filter) eq 'ARRAY') |
|
32
|
|
|
|
|
|
|
{ |
|
33
|
0
|
|
|
|
|
|
my %filter = map { $_ => 1 } @{ $self->filter }; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$filter = sub { |
|
35
|
0
|
|
|
0
|
|
|
my($file) = @_; |
|
36
|
0
|
|
|
|
|
|
! $filter{$file->{version}}; |
|
37
|
0
|
|
|
|
|
|
}; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
elsif(ref($self->filter) eq 'CODE') |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
0
|
|
|
|
|
|
my $code = $self->filter; |
|
42
|
0
|
|
|
0
|
|
|
$filter = sub { ! $code->($_[0]) }; |
|
|
0
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
else |
|
45
|
|
|
|
|
|
|
{ |
|
46
|
0
|
|
|
|
|
|
Carp::croak("unknown filter type for Prefer::BadVersion"); |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$meta->around_hook( |
|
50
|
|
|
|
|
|
|
prefer => sub { |
|
51
|
0
|
|
|
0
|
|
|
my($orig, $build, @therest) = @_; |
|
52
|
0
|
|
|
|
|
|
my $res1 = $orig->($build, @therest); |
|
53
|
0
|
0
|
|
|
|
|
return $res1 unless $res1->{type} eq 'list'; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
return { |
|
56
|
|
|
|
|
|
|
type => 'list', |
|
57
|
|
|
|
|
|
|
list => [ |
|
58
|
0
|
|
|
|
|
|
grep { $filter->($_) } @{ $res1->{list} } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
], |
|
60
|
|
|
|
|
|
|
}; |
|
61
|
|
|
|
|
|
|
}, |
|
62
|
0
|
|
|
|
|
|
); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |