line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Find a package/distribution target among CPAN-like repositories |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Pinto::Locator::Multiplex; |
4
|
|
|
|
|
|
|
|
5
|
51
|
|
|
51
|
|
633
|
use Moose; |
|
51
|
|
|
|
|
112
|
|
|
51
|
|
|
|
|
372
|
|
6
|
51
|
|
|
51
|
|
325093
|
use MooseX::Types::Moose qw(ArrayRef); |
|
51
|
|
|
|
|
42489
|
|
|
51
|
|
|
|
|
611
|
|
7
|
51
|
|
|
51
|
|
245708
|
use MooseX::MarkAsMethods (autoclean => 1); |
|
51
|
|
|
|
|
147
|
|
|
51
|
|
|
|
|
477
|
|
8
|
|
|
|
|
|
|
|
9
|
51
|
|
|
51
|
|
198898
|
use Pinto::Locator::Mirror; |
|
51
|
|
|
|
|
198
|
|
|
51
|
|
|
|
|
2237
|
|
10
|
51
|
|
|
51
|
|
21595
|
use Pinto::Locator::Stratopan; |
|
51
|
|
|
|
|
194
|
|
|
51
|
|
|
|
|
2447
|
|
11
|
51
|
|
|
51
|
|
473
|
use Pinto::Constants qw(:stratopan); |
|
51
|
|
|
|
|
121
|
|
|
51
|
|
|
|
|
4218
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.14'; # VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
extends qw(Pinto::Locator); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has locators => ( |
24
|
|
|
|
|
|
|
is => 'ro', |
25
|
|
|
|
|
|
|
isa => ArrayRef['Pinto::Locator'], |
26
|
|
|
|
|
|
|
writer => '_set_locators', |
27
|
|
|
|
|
|
|
default => sub { [] }, |
28
|
|
|
|
|
|
|
lazy => 1, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub assemble { |
34
|
37
|
|
|
37
|
0
|
2017
|
my ($self, @uris) = @_; |
35
|
|
|
|
|
|
|
|
36
|
37
|
|
|
|
|
96
|
my @locators; |
37
|
37
|
|
|
|
|
130
|
for my $uri (@uris) { |
38
|
49
|
|
|
|
|
233
|
my $class = $self->locator_class_for_uri($uri); |
39
|
|
|
|
|
|
|
# Ick: This assumes all Locators have same attribute interface |
40
|
49
|
|
|
|
|
1651
|
my %args = ( uri => $uri, cache_dir => $self->cache_dir ); |
41
|
49
|
|
|
|
|
1606
|
push @locators, $class->new( %args ); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
37
|
|
|
|
|
1324
|
$self->_set_locators(\@locators); |
45
|
37
|
|
|
|
|
820
|
return $self; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub locate_package { |
51
|
68
|
|
|
68
|
0
|
315
|
my ($self, %args) = @_; |
52
|
|
|
|
|
|
|
|
53
|
68
|
|
|
|
|
173
|
my @all_found; |
54
|
68
|
|
|
|
|
147
|
for my $locator ( @{ $self->locators } ) { |
|
68
|
|
|
|
|
1996
|
|
55
|
76
|
100
|
|
|
|
794
|
next unless my $found = $locator->locate_package(%args); |
56
|
55
|
|
|
|
|
224
|
push @all_found, $found; |
57
|
55
|
100
|
|
|
|
299
|
last unless $args{cascade}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
68
|
100
|
|
|
|
1022
|
return if not @all_found; |
61
|
53
|
|
|
|
|
253
|
@all_found = reverse sort {$a->{version} <=> $b->{version}} @all_found; |
|
2
|
|
|
|
|
27
|
|
62
|
53
|
|
|
|
|
584
|
return $all_found[0]; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub locate_distribution { |
68
|
6
|
|
|
6
|
0
|
30
|
my ($self, %args) = @_; |
69
|
|
|
|
|
|
|
|
70
|
6
|
|
|
|
|
16
|
for my $locator ( @{ $self->locators } ) { |
|
6
|
|
|
|
|
174
|
|
71
|
8
|
100
|
|
|
|
57
|
next unless my $found = $locator->locate_distribution(%args); |
72
|
5
|
|
|
|
|
6861
|
return $found; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
|
|
13
|
return; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub locator_class_for_uri { |
81
|
49
|
|
|
49
|
0
|
137
|
my ($self, $uri) = @_; |
82
|
|
|
|
|
|
|
|
83
|
49
|
|
|
|
|
137
|
my $baseclass = 'Pinto::Locator'; |
84
|
49
|
100
|
|
|
|
371
|
my $subclass = $uri eq $PINTO_STRATOPAN_CPAN_URI ? 'Stratopan' : 'Mirror'; |
85
|
|
|
|
|
|
|
|
86
|
49
|
|
|
|
|
3479
|
return $baseclass . '::' . $subclass; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub refresh { |
93
|
2
|
|
|
2
|
0
|
10
|
my ($self) = @_; |
94
|
|
|
|
|
|
|
|
95
|
2
|
|
|
|
|
6
|
$_->refresh for @{ $self->locators }; |
|
2
|
|
|
|
|
60
|
|
96
|
|
|
|
|
|
|
|
97
|
2
|
|
|
|
|
9
|
return $self; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
__END__ |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=pod |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=encoding UTF-8 |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=for :stopwords Jeffrey Ryan Thalhammer |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 NAME |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Pinto::Locator::Multiplex - Find a package/distribution target among CPAN-like repositories |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 VERSION |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
version 0.14 |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 AUTHOR |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Jeffrey Ryan Thalhammer <jeff@stratopan.com> |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
133
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |