line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
19
|
|
|
19
|
|
8305
|
use strict; |
|
19
|
|
|
|
|
37
|
|
|
19
|
|
|
|
|
557
|
|
2
|
19
|
|
|
19
|
|
82
|
use warnings; |
|
19
|
|
|
|
|
28
|
|
|
19
|
|
|
|
|
688
|
|
3
|
|
|
|
|
|
|
package MetaCPAN::Client::File; |
4
|
|
|
|
|
|
|
# ABSTRACT: A File data object |
5
|
|
|
|
|
|
|
$MetaCPAN::Client::File::VERSION = '2.030000'; |
6
|
19
|
|
|
19
|
|
124
|
use Moo; |
|
19
|
|
|
|
|
30
|
|
|
19
|
|
|
|
|
93
|
|
7
|
19
|
|
|
19
|
|
5226
|
use Carp; |
|
19
|
|
|
|
|
67
|
|
|
19
|
|
|
|
|
8588
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'MetaCPAN::Client::Role::Entity'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my %known_fields = ( |
12
|
|
|
|
|
|
|
scalar => [qw< |
13
|
|
|
|
|
|
|
abstract |
14
|
|
|
|
|
|
|
author |
15
|
|
|
|
|
|
|
authorized |
16
|
|
|
|
|
|
|
binary |
17
|
|
|
|
|
|
|
date |
18
|
|
|
|
|
|
|
deprecated |
19
|
|
|
|
|
|
|
description |
20
|
|
|
|
|
|
|
directory |
21
|
|
|
|
|
|
|
distribution |
22
|
|
|
|
|
|
|
documentation |
23
|
|
|
|
|
|
|
download_url |
24
|
|
|
|
|
|
|
id |
25
|
|
|
|
|
|
|
indexed |
26
|
|
|
|
|
|
|
level |
27
|
|
|
|
|
|
|
maturity |
28
|
|
|
|
|
|
|
mime |
29
|
|
|
|
|
|
|
name |
30
|
|
|
|
|
|
|
path |
31
|
|
|
|
|
|
|
release |
32
|
|
|
|
|
|
|
sloc |
33
|
|
|
|
|
|
|
slop |
34
|
|
|
|
|
|
|
status |
35
|
|
|
|
|
|
|
version |
36
|
|
|
|
|
|
|
version_numified |
37
|
|
|
|
|
|
|
>], |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
arrayref => [qw< module pod_lines >], |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
hashref => [qw< stat >], |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my @known_fields = |
45
|
|
|
|
|
|
|
map { @{ $known_fields{$_} } } qw< scalar arrayref hashref >; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
foreach my $field (@known_fields) { |
48
|
|
|
|
|
|
|
has $field => ( |
49
|
|
|
|
|
|
|
is => 'ro', |
50
|
|
|
|
|
|
|
lazy => 1, |
51
|
|
|
|
|
|
|
default => sub { |
52
|
|
|
|
|
|
|
my $self = shift; |
53
|
|
|
|
|
|
|
return $self->data->{$field}; |
54
|
|
|
|
|
|
|
}, |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
68
|
|
|
68
|
|
202
|
sub _known_fields { return \%known_fields } |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub pod { |
61
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
62
|
0
|
|
0
|
|
|
0
|
my $ctype = shift || "plain"; |
63
|
0
|
|
|
|
|
0
|
$ctype = lc($ctype); |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
0
|
grep { $ctype eq $_ } qw |
|
0
|
|
|
|
|
0
|
|
66
|
|
|
|
|
|
|
or croak "wrong content-type for POD requested"; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
0
|
my $name = $self->module->[0]{name}; |
69
|
0
|
0
|
|
|
|
0
|
return unless $name; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
0
|
require MetaCPAN::Client::Request; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
return |
74
|
0
|
|
|
|
|
0
|
MetaCPAN::Client::Request->new->fetch( |
75
|
|
|
|
|
|
|
"pod/${name}?content-type=text/${ctype}" |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub source { |
80
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
81
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
23
|
my $author = $self->author; |
83
|
1
|
|
|
|
|
22
|
my $release = $self->release; |
84
|
1
|
|
|
|
|
26
|
my $path = $self->path; |
85
|
|
|
|
|
|
|
|
86
|
1
|
|
|
|
|
19
|
require MetaCPAN::Client::Request; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
return |
89
|
1
|
|
|
|
|
22
|
MetaCPAN::Client::Request->new->fetch( |
90
|
|
|
|
|
|
|
"source/${author}/${release}/${path}" |
91
|
|
|
|
|
|
|
); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub metacpan_url { |
95
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
96
|
0
|
|
|
|
|
|
sprintf("https://metacpan.org/source/%s/%s/%s", |
97
|
|
|
|
|
|
|
$self->author, $self->release, $self->path ); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |