line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
15
|
|
|
15
|
|
10697
|
use strict; |
|
15
|
|
|
|
|
199
|
|
|
15
|
|
|
|
|
983
|
|
2
|
15
|
|
|
15
|
|
79
|
use warnings; |
|
15
|
|
|
|
|
26
|
|
|
15
|
|
|
|
|
752
|
|
3
|
|
|
|
|
|
|
package MetaCPAN::API::Author; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$MetaCPAN::API::Author::VERSION = '0.44'; |
6
|
15
|
|
|
15
|
|
76
|
use Carp; |
|
15
|
|
|
|
|
27
|
|
|
15
|
|
|
|
|
1168
|
|
7
|
15
|
|
|
15
|
|
107
|
use Any::Moose 'Role'; |
|
15
|
|
|
|
|
23
|
|
|
15
|
|
|
|
|
131
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub author { |
11
|
2
|
|
|
2
|
1
|
2198
|
my $self = shift; |
12
|
2
|
|
|
|
|
4
|
my ( $pause_id, $url, %extra_opts ); |
13
|
|
|
|
|
|
|
|
14
|
2
|
100
|
|
|
|
8
|
if ( @_ == 1 ) { |
|
|
50
|
|
|
|
|
|
15
|
1
|
|
|
|
|
4
|
$url = 'author/' . shift; |
16
|
|
|
|
|
|
|
} elsif ( @_ == 2 ) { |
17
|
0
|
|
|
|
|
0
|
my %opts = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
0
|
|
|
|
0
|
if ( defined $opts{'pauseid'} ) { |
|
|
0
|
|
|
|
|
|
20
|
0
|
|
|
|
|
0
|
$url = "author/" . $opts{'pauseid'}; |
21
|
|
|
|
|
|
|
} elsif ( defined $opts{'search'} ) { |
22
|
0
|
|
|
|
|
0
|
my $search_opts = $opts{'search'}; |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
0
|
|
|
0
|
ref $search_opts && ref $search_opts eq 'HASH' |
25
|
|
|
|
|
|
|
or croak "'search' key must be hashref"; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
0
|
%extra_opts = %{$search_opts}; |
|
0
|
|
|
|
|
0
|
|
28
|
0
|
|
|
|
|
0
|
$url = 'author/_search'; |
29
|
|
|
|
|
|
|
} else { |
30
|
0
|
|
|
|
|
0
|
croak 'Unknown option given'; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} else { |
33
|
1
|
|
|
|
|
154
|
croak 'Please provide an author PAUSEID or a "search"'; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
7
|
return $self->fetch( $url, %extra_opts ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=pod |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
MetaCPAN::API::Author - Author information for MetaCPAN::API |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 VERSION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
version 0.44 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
This role provides MetaCPAN::API with fetching information about authors. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 METHODS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 author |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $result1 = $mcpan->author('XSAWYERX'); |
62
|
|
|
|
|
|
|
my $result2 = $mcpan->author( pauseid => 'XSAWYERX' ); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Searches MetaCPAN for a specific author. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
You can do complex searches using 'search' parameter: |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# example lifted from MetaCPAN docs |
69
|
|
|
|
|
|
|
my $result = $mcpan->author( |
70
|
|
|
|
|
|
|
search => { |
71
|
|
|
|
|
|
|
q => 'profile.name:twitter', |
72
|
|
|
|
|
|
|
size => 1, |
73
|
|
|
|
|
|
|
}, |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHOR |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Sawyer X <xsawyerx@cpan.org> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Sawyer X. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
85
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|