line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
19
|
|
|
19
|
|
116
|
use strict; |
|
19
|
|
|
|
|
33
|
|
|
19
|
|
|
|
|
494
|
|
2
|
19
|
|
|
19
|
|
82
|
use warnings; |
|
19
|
|
|
|
|
42
|
|
|
19
|
|
|
|
|
761
|
|
3
|
|
|
|
|
|
|
package MetaCPAN::Client::Pod; |
4
|
|
|
|
|
|
|
# ABSTRACT: A Pod object |
5
|
|
|
|
|
|
|
$MetaCPAN::Client::Pod::VERSION = '2.030000'; |
6
|
19
|
|
|
19
|
|
133
|
use Moo; |
|
19
|
|
|
|
|
35
|
|
|
19
|
|
|
|
|
98
|
|
7
|
19
|
|
|
19
|
|
5228
|
use Carp; |
|
19
|
|
|
|
|
43
|
|
|
19
|
|
|
|
|
1163
|
|
8
|
|
|
|
|
|
|
|
9
|
19
|
|
|
19
|
|
112
|
use MetaCPAN::Client::Types qw< Str >; |
|
19
|
|
|
|
|
32
|
|
|
19
|
|
|
|
|
5534
|
|
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
|
|
2
|
my $self = shift; |
41
|
1
|
|
50
|
|
|
3
|
my $ctype = shift || "plain"; |
42
|
1
|
|
|
|
|
5
|
$ctype =~ s/_/-/; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
5
|
my $url = 'pod/' . $self->name . '?content-type=text/' . $ctype; |
45
|
1
|
50
|
|
|
|
4
|
$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__ |