line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
19
|
|
|
19
|
|
142
|
use strict; |
|
19
|
|
|
|
|
47
|
|
|
19
|
|
|
|
|
620
|
|
2
|
19
|
|
|
19
|
|
106
|
use warnings; |
|
19
|
|
|
|
|
41
|
|
|
19
|
|
|
|
|
901
|
|
3
|
|
|
|
|
|
|
package MetaCPAN::Client::Distribution; |
4
|
|
|
|
|
|
|
# ABSTRACT: A Distribution data object |
5
|
|
|
|
|
|
|
$MetaCPAN::Client::Distribution::VERSION = '2.029000'; |
6
|
19
|
|
|
19
|
|
134
|
use Moo; |
|
19
|
|
|
|
|
45
|
|
|
19
|
|
|
|
|
128
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with 'MetaCPAN::Client::Role::Entity'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %known_fields = ( |
11
|
|
|
|
|
|
|
scalar => [qw< name >], |
12
|
|
|
|
|
|
|
arrayref => [], |
13
|
|
|
|
|
|
|
hashref => [qw< bugs river >] |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my %__known_fields_ex = ( |
17
|
|
|
|
|
|
|
map { my $k = $_; $k => +{ map { $_ => 1 } @{ $known_fields{$k} } } } |
18
|
|
|
|
|
|
|
keys %known_fields |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my @known_fields = map { @{ $known_fields{$_} } } keys %known_fields; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
foreach my $field ( @known_fields ) { |
24
|
|
|
|
|
|
|
has $field => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
lazy => 1, |
27
|
|
|
|
|
|
|
default => sub { |
28
|
|
|
|
|
|
|
my $self = shift; |
29
|
|
|
|
|
|
|
return ( |
30
|
|
|
|
|
|
|
exists $self->data->{$field} ? $self->data->{$field} : |
31
|
|
|
|
|
|
|
exists $__known_fields_ex{hashref}{$field} ? {} : |
32
|
|
|
|
|
|
|
exists $__known_fields_ex{arrayref}{$field} ? [] : |
33
|
|
|
|
|
|
|
exists $__known_fields_ex{scalar}{$field} ? '' : |
34
|
|
|
|
|
|
|
undef |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
2
|
|
11
|
sub _known_fields { return \%known_fields } |
41
|
|
|
|
|
|
|
|
42
|
1
|
50
|
|
1
|
1
|
30
|
sub rt { $_[0]->bugs->{rt} || {} } |
43
|
1
|
50
|
|
1
|
1
|
27
|
sub github { $_[0]->bugs->{github} || {} } |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
0
|
1
|
|
sub metacpan_url { "https://metacpan.org/release/" . $_[0]->name } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |