line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::PAUSE::Comaint::PackageScanner; |
2
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
546
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
38071
|
|
|
1
|
|
|
|
|
27
|
|
5
|
1
|
|
|
1
|
|
475
|
use YAML; |
|
1
|
|
|
|
|
6283
|
|
|
1
|
|
|
|
|
345
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
0
|
|
|
0
|
0
|
|
my($class, $base_url) = @_; |
9
|
0
|
|
|
|
|
|
my $self = { |
10
|
|
|
|
|
|
|
ua => LWP::UserAgent->new(agent => __PACKAGE__), |
11
|
|
|
|
|
|
|
api_version => 'v1.0', |
12
|
|
|
|
|
|
|
base_url => $base_url, |
13
|
|
|
|
|
|
|
}; |
14
|
0
|
|
|
|
|
|
bless $self, $class; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
0
|
0
|
|
sub ua { $_[0]->{ua} } |
18
|
0
|
|
|
0
|
0
|
|
sub base_url { $_[0]->{base_url} } |
19
|
0
|
|
|
0
|
0
|
|
sub api_version { $_[0]->{api_version} } |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub find { |
22
|
0
|
|
|
0
|
0
|
|
my($self, $want) = @_; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my $url = sprintf '%s/%s/package/%s', $self->base_url, $self->api_version, $want; |
25
|
0
|
|
|
|
|
|
my $res = $self->ua->get($url); |
26
|
0
|
0
|
|
|
|
|
return unless $res->is_success; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $package = YAML::Load($res->content); |
29
|
0
|
|
|
|
|
|
return sort keys %{ $package->{provides} }; |
|
0
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |