line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
19
|
|
|
19
|
|
142
|
use strict; |
|
19
|
|
|
|
|
44
|
|
|
19
|
|
|
|
|
594
|
|
2
|
19
|
|
|
19
|
|
97
|
use warnings; |
|
19
|
|
|
|
|
62
|
|
|
19
|
|
|
|
|
891
|
|
3
|
|
|
|
|
|
|
package MetaCPAN::Client::Pod; |
4
|
|
|
|
|
|
|
# ABSTRACT: A Pod object |
5
|
|
|
|
|
|
|
$MetaCPAN::Client::Pod::VERSION = '2.029000'; |
6
|
19
|
|
|
19
|
|
118
|
use Moo; |
|
19
|
|
|
|
|
47
|
|
|
19
|
|
|
|
|
103
|
|
7
|
19
|
|
|
19
|
|
6504
|
use Carp; |
|
19
|
|
|
|
|
44
|
|
|
19
|
|
|
|
|
1625
|
|
8
|
|
|
|
|
|
|
|
9
|
19
|
|
|
19
|
|
162
|
use MetaCPAN::Client::Types qw< Str >; |
|
19
|
|
|
|
|
47
|
|
|
19
|
|
|
|
|
6062
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has request => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
handles => [qw], |
14
|
|
|
|
|
|
|
required => 1, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has name => ( is => 'ro', required => 1 ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has url_prefix => ( |
20
|
|
|
|
|
|
|
is => 'ro', |
21
|
|
|
|
|
|
|
isa => Str, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my @known_formats = qw< |
25
|
|
|
|
|
|
|
html plain x_pod x_markdown |
26
|
|
|
|
|
|
|
>; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
foreach my $format (@known_formats) { |
29
|
|
|
|
|
|
|
has $format => ( |
30
|
|
|
|
|
|
|
is => 'ro', |
31
|
|
|
|
|
|
|
lazy => 1, |
32
|
|
|
|
|
|
|
default => sub { |
33
|
|
|
|
|
|
|
my $self = shift; |
34
|
|
|
|
|
|
|
return $self->_request( $format ); |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _request { |
40
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
41
|
1
|
|
50
|
|
|
5
|
my $ctype = shift || "plain"; |
42
|
1
|
|
|
|
|
4
|
$ctype =~ s/_/-/; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
8
|
my $url = 'pod/' . $self->name . '?content-type=text/' . $ctype; |
45
|
1
|
50
|
|
|
|
5
|
$self->url_prefix and $url .= '&url_prefix=' . $self->url_prefix; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
5
|
return $self->request->fetch($url); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |