line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
19
|
|
|
19
|
|
139
|
use strict; |
|
19
|
|
|
|
|
47
|
|
|
19
|
|
|
|
|
599
|
|
2
|
19
|
|
|
19
|
|
107
|
use warnings; |
|
19
|
|
|
|
|
36
|
|
|
19
|
|
|
|
|
842
|
|
3
|
|
|
|
|
|
|
package MetaCPAN::Client::Pod; |
4
|
|
|
|
|
|
|
# ABSTRACT: A Pod object |
5
|
|
|
|
|
|
|
$MetaCPAN::Client::Pod::VERSION = '2.028000'; |
6
|
19
|
|
|
19
|
|
123
|
use Moo; |
|
19
|
|
|
|
|
71
|
|
|
19
|
|
|
|
|
147
|
|
7
|
19
|
|
|
19
|
|
6415
|
use Carp; |
|
19
|
|
|
|
|
63
|
|
|
19
|
|
|
|
|
1426
|
|
8
|
|
|
|
|
|
|
|
9
|
19
|
|
|
19
|
|
155
|
use MetaCPAN::Client::Types qw< Str >; |
|
19
|
|
|
|
|
67
|
|
|
19
|
|
|
|
|
6010
|
|
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
|
|
|
|
|
7
|
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
|
|
|
|
|
6
|
return $self->request->fetch($url); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |