line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
15
|
|
|
15
|
|
9348
|
use strict; |
|
15
|
|
|
|
|
34
|
|
|
15
|
|
|
|
|
534
|
|
2
|
15
|
|
|
15
|
|
83
|
use warnings; |
|
15
|
|
|
|
|
30
|
|
|
15
|
|
|
|
|
747
|
|
3
|
|
|
|
|
|
|
package MetaCPAN::API::Distribution; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$MetaCPAN::API::Distribution::VERSION = '0.44'; |
6
|
15
|
|
|
15
|
|
77
|
use Carp; |
|
15
|
|
|
|
|
25
|
|
|
15
|
|
|
|
|
1081
|
|
7
|
15
|
|
|
15
|
|
84
|
use Any::Moose 'Role'; |
|
15
|
|
|
|
|
25
|
|
|
15
|
|
|
|
|
162
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub distribution { |
11
|
5
|
|
|
5
|
0
|
11337
|
my $self = shift; |
12
|
5
|
|
|
|
|
12
|
my $url = ''; |
13
|
5
|
|
|
|
|
12
|
my $error = "Either provide a distribution or 'search'"; |
14
|
|
|
|
|
|
|
|
15
|
5
|
|
|
|
|
10
|
my %extra_opts = (); |
16
|
|
|
|
|
|
|
|
17
|
5
|
100
|
|
|
|
22
|
if ( @_ == 1 ) { |
|
|
100
|
|
|
|
|
|
18
|
1
|
|
|
|
|
4
|
$url = 'distribution/' . shift; |
19
|
|
|
|
|
|
|
} elsif ( @_ ) { |
20
|
3
|
|
|
|
|
13
|
my %opts = @_; |
21
|
|
|
|
|
|
|
|
22
|
3
|
100
|
|
|
|
16
|
if ( defined ( my $dist = $opts{'distribution'} ) ) { |
|
|
100
|
|
|
|
|
|
23
|
1
|
|
|
|
|
32
|
$url = "distribution/$dist"; |
24
|
|
|
|
|
|
|
} elsif ( defined ( my $search_opts = $opts{'search'} ) ) { |
25
|
1
|
50
|
33
|
|
|
9
|
ref $search_opts && ref $search_opts eq 'HASH' |
26
|
|
|
|
|
|
|
or croak $error; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
2
|
%extra_opts = %{$search_opts}; |
|
1
|
|
|
|
|
5
|
|
29
|
1
|
|
|
|
|
3
|
$url = 'distribution/_search'; |
30
|
|
|
|
|
|
|
} else { |
31
|
1
|
|
|
|
|
102
|
croak $error; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} else { |
34
|
1
|
|
|
|
|
193
|
croak $error; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
3
|
|
|
|
|
18
|
return $self->fetch( $url, %extra_opts ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=pod |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 NAME |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
MetaCPAN::API::Distribution - Distribution information for MetaCPAN::API |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 VERSION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
version 0.44 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This role provides MetaCPAN::API with fetching information about distributions, |
57
|
|
|
|
|
|
|
returning information about the distribution which is not specific to a version |
58
|
|
|
|
|
|
|
(like RT bug counts). |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 METHODS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 distibution |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $result = $mcpan->distibution('DBIx-Class'); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Searches MetaCPAN for a dist. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
You can do complex searches using 'search' parameter: |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my $result = $mcpan->distribution( |
71
|
|
|
|
|
|
|
search => { |
72
|
|
|
|
|
|
|
filter => { exists => { field => 'bugs.source' } }, |
73
|
|
|
|
|
|
|
fields => ['name', 'bugs.source'], |
74
|
|
|
|
|
|
|
size => 5, |
75
|
|
|
|
|
|
|
}, |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHOR |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Sawyer X <xsawyerx@cpan.org> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Sawyer X. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
87
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|