line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
15
|
|
|
15
|
|
6258
|
use strict; |
|
15
|
|
|
|
|
33
|
|
|
15
|
|
|
|
|
359
|
|
2
|
15
|
|
|
15
|
|
71
|
use warnings; |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
601
|
|
3
|
|
|
|
|
|
|
package MetaCPAN::API::Release; |
4
|
|
|
|
|
|
|
# ABSTRACT: Distribution and releases information for MetaCPAN::API |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.51'; |
7
|
|
|
|
|
|
|
|
8
|
15
|
|
|
15
|
|
71
|
use Carp; |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
614
|
|
9
|
15
|
|
|
15
|
|
77
|
use Moo::Role; |
|
15
|
|
|
|
|
30
|
|
|
15
|
|
|
|
|
77
|
|
10
|
15
|
|
|
15
|
|
4356
|
use namespace::autoclean; |
|
15
|
|
|
|
|
30
|
|
|
15
|
|
|
|
|
142
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# /release/{distribution} |
13
|
|
|
|
|
|
|
# /release/{author}/{release} |
14
|
|
|
|
|
|
|
sub release { |
15
|
4
|
|
|
4
|
1
|
3443
|
my $self = shift; |
16
|
4
|
100
|
|
|
|
20
|
my %opts = @_ ? @_ : (); |
17
|
4
|
|
|
|
|
9
|
my $url = ''; |
18
|
4
|
|
|
|
|
9
|
my $error = "Either provide 'distribution', or 'author' and 'release', " . |
19
|
|
|
|
|
|
|
"or 'search'"; |
20
|
|
|
|
|
|
|
|
21
|
4
|
100
|
|
|
|
145
|
%opts or croak $error; |
22
|
|
|
|
|
|
|
|
23
|
3
|
|
|
|
|
7
|
my %extra_opts = (); |
24
|
|
|
|
|
|
|
|
25
|
3
|
100
|
66
|
|
|
21
|
if ( defined ( my $dist = $opts{'distribution'} ) ) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
26
|
1
|
|
|
|
|
3
|
$url = "release/$dist"; |
27
|
|
|
|
|
|
|
} elsif ( |
28
|
|
|
|
|
|
|
defined ( my $author = $opts{'author'} ) && |
29
|
|
|
|
|
|
|
defined ( my $release = $opts{'release'} ) |
30
|
|
|
|
|
|
|
) { |
31
|
1
|
|
|
|
|
4
|
$url = "release/$author/$release"; |
32
|
|
|
|
|
|
|
} elsif ( defined ( my $search_opts = $opts{'search'} ) ) { |
33
|
0
|
0
|
0
|
|
|
0
|
ref $search_opts && ref $search_opts eq 'HASH' |
34
|
|
|
|
|
|
|
or croak $error; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
0
|
%extra_opts = %{$search_opts}; |
|
0
|
|
|
|
|
0
|
|
37
|
0
|
|
|
|
|
0
|
$url = 'release/_search'; |
38
|
|
|
|
|
|
|
} else { |
39
|
1
|
|
|
|
|
60
|
croak $error; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
|
|
13
|
return $self->fetch( $url, %extra_opts ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |