| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
15
|
|
|
15
|
|
9698
|
use strict; |
|
|
15
|
|
|
|
|
29
|
|
|
|
15
|
|
|
|
|
507
|
|
|
2
|
15
|
|
|
15
|
|
80
|
use warnings; |
|
|
15
|
|
|
|
|
29
|
|
|
|
15
|
|
|
|
|
738
|
|
|
3
|
|
|
|
|
|
|
package MetaCPAN::API::POD; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$MetaCPAN::API::POD::VERSION = '0.44'; |
|
6
|
15
|
|
|
15
|
|
77
|
use Carp; |
|
|
15
|
|
|
|
|
26
|
|
|
|
15
|
|
|
|
|
902
|
|
|
7
|
15
|
|
|
15
|
|
77
|
use Any::Moose 'Role'; |
|
|
15
|
|
|
|
|
39
|
|
|
|
15
|
|
|
|
|
116
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub pod { |
|
12
|
9
|
|
|
9
|
1
|
8614
|
my $self = shift; |
|
13
|
9
|
100
|
|
|
|
163
|
my %opts = @_ ? @_ : (); |
|
14
|
9
|
|
|
|
|
47
|
my $url = ''; |
|
15
|
9
|
|
|
|
|
18
|
my $error = "Either provide 'module' or 'author and 'release' and 'path'"; |
|
16
|
|
|
|
|
|
|
|
|
17
|
9
|
100
|
|
|
|
209
|
%opts or croak $error; |
|
18
|
|
|
|
|
|
|
|
|
19
|
8
|
100
|
66
|
|
|
6450
|
if ( defined ( my $module = $opts{'module'} ) ) { |
|
|
|
100
|
66
|
|
|
|
|
|
20
|
6
|
|
|
|
|
16
|
$url = "pod/$module"; |
|
21
|
|
|
|
|
|
|
} elsif ( |
|
22
|
|
|
|
|
|
|
defined ( my $author = $opts{'author'} ) && |
|
23
|
|
|
|
|
|
|
defined ( my $release = $opts{'release'} ) && |
|
24
|
|
|
|
|
|
|
defined ( my $path = $opts{'path'} ) |
|
25
|
|
|
|
|
|
|
) { |
|
26
|
1
|
|
|
|
|
55
|
$url = "pod/$author/$release/$path"; |
|
27
|
|
|
|
|
|
|
} else { |
|
28
|
1
|
|
|
|
|
272
|
croak $error; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
7
|
|
|
|
|
16
|
my %extra = (); |
|
33
|
7
|
100
|
|
|
|
26
|
if ( defined ( my $type = $opts{'content-type'} ) ) { |
|
34
|
5
|
100
|
|
|
|
183
|
$type =~ m{^ text/ (?: html|plain|x-pod|x-markdown ) $}x |
|
35
|
|
|
|
|
|
|
or croak 'Incorrect content-type provided'; |
|
36
|
|
|
|
|
|
|
|
|
37
|
4
|
|
|
|
|
14
|
$extra{headers}{'content-type'} = $type; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
6
|
|
|
|
|
51
|
$url = $self->base_url . "/$url"; |
|
41
|
|
|
|
|
|
|
|
|
42
|
6
|
|
|
|
|
243
|
my $result = $self->ua->get( $url, \%extra ); |
|
43
|
6
|
50
|
|
|
|
924513
|
$result->{'success'} |
|
44
|
|
|
|
|
|
|
or croak "Failed to fetch '$url': " . $result->{'reason'}; |
|
45
|
|
|
|
|
|
|
|
|
46
|
6
|
|
|
|
|
355
|
return $result->{'content'}; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=pod |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
MetaCPAN::API::POD - POD information for MetaCPAN::API |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 VERSION |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
version 0.44 |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This role provides MetaCPAN::API with fetching POD information about modules |
|
66
|
|
|
|
|
|
|
and distribution releases. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 METHODS |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 pod |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my $result = $mcpan->pod( module => 'Moose' ); |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# or |
|
75
|
|
|
|
|
|
|
my $result = $mcpan->pod( |
|
76
|
|
|
|
|
|
|
author => 'DOY', |
|
77
|
|
|
|
|
|
|
release => 'Moose-2.0201', |
|
78
|
|
|
|
|
|
|
path => 'lib/Moose.pm', |
|
79
|
|
|
|
|
|
|
); |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Searches MetaCPAN for a module or a specific release and returns the POD. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Content type can also be specified, like so: |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my $result = $mcpan->pod( module => 'Moose', 'content-type' => 'x-pod' ); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 AUTHOR |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Sawyer X <xsawyerx@cpan.org> |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Sawyer X. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
96
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
|
99
|
|
|
|
|
|
|
|