line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
20
|
|
|
20
|
|
822
|
use strict; |
|
20
|
|
|
|
|
67
|
|
|
20
|
|
|
|
|
660
|
|
2
|
20
|
|
|
20
|
|
117
|
use warnings; |
|
20
|
|
|
|
|
55
|
|
|
20
|
|
|
|
|
969
|
|
3
|
|
|
|
|
|
|
package MetaCPAN::Client::Release; |
4
|
|
|
|
|
|
|
# ABSTRACT: A Release data object |
5
|
|
|
|
|
|
|
$MetaCPAN::Client::Release::VERSION = '2.028000'; |
6
|
20
|
|
|
20
|
|
122
|
use Moo; |
|
20
|
|
|
|
|
49
|
|
|
20
|
|
|
|
|
112
|
|
7
|
20
|
|
|
20
|
|
6949
|
use Ref::Util qw< is_hashref >; |
|
20
|
|
|
|
|
61
|
|
|
20
|
|
|
|
|
1328
|
|
8
|
20
|
|
|
20
|
|
163
|
use JSON::MaybeXS qw< decode_json >; |
|
20
|
|
|
|
|
55
|
|
|
20
|
|
|
|
|
10308
|
|
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
|
|
|
|
|
|
|
date |
20
|
|
|
|
|
|
|
deprecated |
21
|
|
|
|
|
|
|
distribution |
22
|
|
|
|
|
|
|
download_url |
23
|
|
|
|
|
|
|
first |
24
|
|
|
|
|
|
|
id |
25
|
|
|
|
|
|
|
maturity |
26
|
|
|
|
|
|
|
main_module |
27
|
|
|
|
|
|
|
name |
28
|
|
|
|
|
|
|
status |
29
|
|
|
|
|
|
|
version |
30
|
|
|
|
|
|
|
version_numified |
31
|
|
|
|
|
|
|
>], |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
arrayref => [qw< |
34
|
|
|
|
|
|
|
dependency |
35
|
|
|
|
|
|
|
license |
36
|
|
|
|
|
|
|
provides |
37
|
|
|
|
|
|
|
>], |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
hashref => [qw< |
40
|
|
|
|
|
|
|
metadata |
41
|
|
|
|
|
|
|
resources |
42
|
|
|
|
|
|
|
stat |
43
|
|
|
|
|
|
|
tests |
44
|
|
|
|
|
|
|
>], |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my @known_fields = |
48
|
|
|
|
|
|
|
map { @{ $known_fields{$_} } } qw< scalar arrayref hashref >; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
foreach my $field (@known_fields) { |
51
|
|
|
|
|
|
|
has $field => ( |
52
|
|
|
|
|
|
|
is => 'ro', |
53
|
|
|
|
|
|
|
lazy => 1, |
54
|
|
|
|
|
|
|
default => sub { |
55
|
|
|
|
|
|
|
my $self = shift; |
56
|
|
|
|
|
|
|
return $self->data->{$field}; |
57
|
|
|
|
|
|
|
}, |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
56
|
|
|
56
|
|
126
|
sub _known_fields { return \%known_fields } |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub changes { |
64
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
65
|
0
|
|
|
|
|
|
my $url = sprintf "https://fastapi.metacpan.org/changes/%s/%s", $self->author, $self->name; |
66
|
0
|
|
|
|
|
|
my $res = $self->ua->get($url); |
67
|
0
|
0
|
|
|
|
|
return unless is_hashref($res); |
68
|
0
|
|
|
|
|
|
my $content = decode_json $res->{'content'}; |
69
|
0
|
|
|
|
|
|
return $content->{'content'}; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub metacpan_url { |
73
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
74
|
0
|
|
|
|
|
|
sprintf( "https://metacpan.org/release/%s/%s", $self->author, $self->name ) |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub contributors { |
78
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
79
|
0
|
|
|
|
|
|
my $url = sprintf( "https://fastapi.metacpan.org/release/contributors/%s/%s", $self->author, $self->name ); |
80
|
0
|
|
|
|
|
|
my $res = $self->ua->get($url); |
81
|
0
|
0
|
|
|
|
|
return unless is_hashref($res); |
82
|
0
|
|
|
|
|
|
my $content = decode_json $res->{'content'}; |
83
|
0
|
|
|
|
|
|
return $content->{'contributors'}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
__END__ |