line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
15
|
|
|
15
|
|
9496
|
use strict; |
|
15
|
|
|
|
|
29
|
|
|
15
|
|
|
|
|
689
|
|
2
|
15
|
|
|
15
|
|
83
|
use warnings; |
|
15
|
|
|
|
|
26
|
|
|
15
|
|
|
|
|
668
|
|
3
|
|
|
|
|
|
|
package MetaCPAN::API::Favorite; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$MetaCPAN::API::Favorite::VERSION = '0.44'; |
6
|
15
|
|
|
15
|
|
75
|
use Carp; |
|
15
|
|
|
|
|
27
|
|
|
15
|
|
|
|
|
913
|
|
7
|
15
|
|
|
15
|
|
82
|
use Any::Moose 'Role'; |
|
15
|
|
|
|
|
33
|
|
|
15
|
|
|
|
|
90
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub favorite { |
11
|
3
|
|
|
3
|
1
|
3280
|
my $self = shift; |
12
|
3
|
100
|
|
|
|
16
|
my %opts = @_ ? @_ : (); |
13
|
3
|
|
|
|
|
7
|
my $url = ''; |
14
|
3
|
|
|
|
|
5
|
my $error = "Only 'search' can be used here"; |
15
|
|
|
|
|
|
|
|
16
|
3
|
100
|
|
|
|
287
|
%opts or croak $error; |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
4
|
my %extra_opts = (); |
19
|
|
|
|
|
|
|
|
20
|
2
|
100
|
|
|
|
13
|
if ( defined ( my $search_opts = $opts{'search'} ) ) { |
21
|
1
|
50
|
33
|
|
|
23
|
ref $search_opts && ref $search_opts eq 'HASH' |
22
|
|
|
|
|
|
|
or croak $error; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
3
|
%extra_opts = %{$search_opts}; |
|
1
|
|
|
|
|
7
|
|
25
|
1
|
|
|
|
|
3
|
$url = 'favorite/_search'; |
26
|
|
|
|
|
|
|
} else { |
27
|
1
|
|
|
|
|
127
|
croak $error; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
9
|
return $self->fetch( $url, %extra_opts ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=pod |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
MetaCPAN::API::Favorite - Favorite ++ information for MetaCPAN::API |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 VERSION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
version 0.44 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 DESCRIPTION |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This role provides MetaCPAN::API with fetching information about favorite |
50
|
|
|
|
|
|
|
++ information. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 METHODS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 favorite |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# example lifted from MetaCPAN docs |
57
|
|
|
|
|
|
|
my $result = $mcpan->favorite( |
58
|
|
|
|
|
|
|
search => { |
59
|
|
|
|
|
|
|
user => "SZABGAB", |
60
|
|
|
|
|
|
|
fields => "distribution", |
61
|
|
|
|
|
|
|
size => 100, |
62
|
|
|
|
|
|
|
}, |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Searches MetaCPAN for favorite ++ information. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Only complex searches are currently available. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 AUTHOR |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Sawyer X <xsawyerx@cpan.org> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Sawyer X. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
78
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|