line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
20
|
|
|
20
|
|
720
|
use strict; |
|
20
|
|
|
|
|
56
|
|
|
20
|
|
|
|
|
686
|
|
2
|
20
|
|
|
20
|
|
118
|
use warnings; |
|
20
|
|
|
|
|
52
|
|
|
20
|
|
|
|
|
914
|
|
3
|
|
|
|
|
|
|
package MetaCPAN::Client::Release; |
4
|
|
|
|
|
|
|
# ABSTRACT: A Release data object |
5
|
|
|
|
|
|
|
$MetaCPAN::Client::Release::VERSION = '2.029000'; |
6
|
20
|
|
|
20
|
|
140
|
use Moo; |
|
20
|
|
|
|
|
45
|
|
|
20
|
|
|
|
|
123
|
|
7
|
20
|
|
|
20
|
|
7027
|
use Ref::Util qw< is_hashref >; |
|
20
|
|
|
|
|
56
|
|
|
20
|
|
|
|
|
1251
|
|
8
|
20
|
|
|
20
|
|
138
|
use JSON::MaybeXS qw< decode_json >; |
|
20
|
|
|
|
|
49
|
|
|
20
|
|
|
|
|
10326
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'MetaCPAN::Client::Role::Entity', |
11
|
|
|
|
|
|
|
'MetaCPAN::Client::Role::HasUA'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my %known_fields = ( |
14
|
|
|
|
|
|
|
scalar => [qw< |
15
|
|
|
|
|
|
|
abstract |
16
|
|
|
|
|
|
|
archive |
17
|
|
|
|
|
|
|
author |
18
|
|
|
|
|
|
|
authorized |
19
|
|
|
|
|
|
|
checksum_md5 |
20
|
|
|
|
|
|
|
checksum_sha256 |
21
|
|
|
|
|
|
|
date |
22
|
|
|
|
|
|
|
deprecated |
23
|
|
|
|
|
|
|
distribution |
24
|
|
|
|
|
|
|
download_url |
25
|
|
|
|
|
|
|
first |
26
|
|
|
|
|
|
|
id |
27
|
|
|
|
|
|
|
maturity |
28
|
|
|
|
|
|
|
main_module |
29
|
|
|
|
|
|
|
name |
30
|
|
|
|
|
|
|
status |
31
|
|
|
|
|
|
|
version |
32
|
|
|
|
|
|
|
version_numified |
33
|
|
|
|
|
|
|
>], |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
arrayref => [qw< |
36
|
|
|
|
|
|
|
dependency |
37
|
|
|
|
|
|
|
license |
38
|
|
|
|
|
|
|
provides |
39
|
|
|
|
|
|
|
>], |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
hashref => [qw< |
42
|
|
|
|
|
|
|
metadata |
43
|
|
|
|
|
|
|
resources |
44
|
|
|
|
|
|
|
stat |
45
|
|
|
|
|
|
|
tests |
46
|
|
|
|
|
|
|
>], |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my @known_fields = |
50
|
|
|
|
|
|
|
map { @{ $known_fields{$_} } } qw< scalar arrayref hashref >; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
foreach my $field (@known_fields) { |
53
|
|
|
|
|
|
|
has $field => ( |
54
|
|
|
|
|
|
|
is => 'ro', |
55
|
|
|
|
|
|
|
lazy => 1, |
56
|
|
|
|
|
|
|
default => sub { |
57
|
|
|
|
|
|
|
my $self = shift; |
58
|
|
|
|
|
|
|
return $self->data->{$field}; |
59
|
|
|
|
|
|
|
}, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
60
|
|
|
60
|
|
138
|
sub _known_fields { return \%known_fields } |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub changes { |
66
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
67
|
0
|
|
|
|
|
|
my $url = sprintf "https://fastapi.metacpan.org/changes/%s/%s", $self->author, $self->name; |
68
|
0
|
|
|
|
|
|
my $res = $self->ua->get($url); |
69
|
0
|
0
|
|
|
|
|
return unless is_hashref($res); |
70
|
0
|
|
|
|
|
|
my $content = decode_json $res->{'content'}; |
71
|
0
|
|
|
|
|
|
return $content->{'content'}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub metacpan_url { |
75
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
76
|
0
|
|
|
|
|
|
sprintf( "https://metacpan.org/release/%s/%s", $self->author, $self->name ) |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub contributors { |
80
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
81
|
0
|
|
|
|
|
|
my $url = sprintf( "https://fastapi.metacpan.org/release/contributors/%s/%s", $self->author, $self->name ); |
82
|
0
|
|
|
|
|
|
my $res = $self->ua->get($url); |
83
|
0
|
0
|
|
|
|
|
return unless is_hashref($res); |
84
|
0
|
|
|
|
|
|
my $content = decode_json $res->{'content'}; |
85
|
0
|
|
|
|
|
|
return $content->{'contributors'}; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__END__ |