| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
15
|
|
|
15
|
|
6580
|
use strict; |
|
|
15
|
|
|
|
|
36
|
|
|
|
15
|
|
|
|
|
375
|
|
|
2
|
15
|
|
|
15
|
|
69
|
use warnings; |
|
|
15
|
|
|
|
|
26
|
|
|
|
15
|
|
|
|
|
585
|
|
|
3
|
|
|
|
|
|
|
package MetaCPAN::API::Distribution; |
|
4
|
|
|
|
|
|
|
# ABSTRACT: Distribution information for MetaCPAN::API |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.51'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
15
|
|
|
15
|
|
71
|
use Carp; |
|
|
15
|
|
|
|
|
26
|
|
|
|
15
|
|
|
|
|
604
|
|
|
9
|
15
|
|
|
15
|
|
68
|
use Moo::Role; |
|
|
15
|
|
|
|
|
29
|
|
|
|
15
|
|
|
|
|
73
|
|
|
10
|
15
|
|
|
15
|
|
4316
|
use namespace::autoclean; |
|
|
15
|
|
|
|
|
33
|
|
|
|
15
|
|
|
|
|
82
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# /distribution/{distribution} |
|
13
|
|
|
|
|
|
|
sub distribution { |
|
14
|
5
|
|
|
5
|
1
|
4182
|
my $self = shift; |
|
15
|
5
|
|
|
|
|
13
|
my $url = ''; |
|
16
|
5
|
|
|
|
|
9
|
my $error = "Either provide a distribution or 'search'"; |
|
17
|
|
|
|
|
|
|
|
|
18
|
5
|
|
|
|
|
14
|
my %extra_opts = (); |
|
19
|
|
|
|
|
|
|
|
|
20
|
5
|
100
|
|
|
|
20
|
if ( @_ == 1 ) { |
|
|
|
100
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
4
|
$url = 'distribution/' . shift; |
|
22
|
|
|
|
|
|
|
} elsif ( @_ ) { |
|
23
|
3
|
|
|
|
|
13
|
my %opts = @_; |
|
24
|
|
|
|
|
|
|
|
|
25
|
3
|
100
|
|
|
|
18
|
if ( defined ( my $dist = $opts{'distribution'} ) ) { |
|
|
|
100
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
4
|
$url = "distribution/$dist"; |
|
27
|
|
|
|
|
|
|
} elsif ( defined ( my $search_opts = $opts{'search'} ) ) { |
|
28
|
1
|
50
|
33
|
|
|
9
|
ref $search_opts && ref $search_opts eq 'HASH' |
|
29
|
|
|
|
|
|
|
or croak $error; |
|
30
|
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
3
|
%extra_opts = %{$search_opts}; |
|
|
1
|
|
|
|
|
5
|
|
|
32
|
1
|
|
|
|
|
5
|
$url = 'distribution/_search'; |
|
33
|
|
|
|
|
|
|
} else { |
|
34
|
1
|
|
|
|
|
60
|
croak $error; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
} else { |
|
37
|
1
|
|
|
|
|
132
|
croak $error; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
3
|
|
|
|
|
19
|
return $self->fetch( $url, %extra_opts ); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |