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