line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Source::Dist; |
2
|
1
|
|
|
1
|
|
1590
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
7
|
use base qw(Class::Accessor::Fast::XS); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
844
|
|
5
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw( |
6
|
|
|
|
|
|
|
name |
7
|
|
|
|
|
|
|
version_name |
8
|
|
|
|
|
|
|
package_name |
9
|
|
|
|
|
|
|
version |
10
|
|
|
|
|
|
|
maturity |
11
|
|
|
|
|
|
|
filename |
12
|
|
|
|
|
|
|
cpanid |
13
|
|
|
|
|
|
|
extension |
14
|
|
|
|
|
|
|
pathname |
15
|
|
|
|
|
|
|
source_path |
16
|
|
|
|
|
|
|
_parent |
17
|
|
|
|
|
|
|
)); |
18
|
|
|
|
|
|
|
use JSON::XS; |
19
|
|
|
|
|
|
|
use YAML::XS; |
20
|
|
|
|
|
|
|
use URI; |
21
|
|
|
|
|
|
|
use overload '""' => \&to_string; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# CPAN::DistnameInfo compatible |
24
|
|
|
|
|
|
|
sub dist { $_[0]->name; } |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub distvname { $_[0]->version_name; } |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub fetch_source_file { |
29
|
|
|
|
|
|
|
my ($self,$file) = @_; |
30
|
|
|
|
|
|
|
return unless $self->source_path; |
31
|
|
|
|
|
|
|
my $uri = URI->new( $self->source_path . '/' . $file ); |
32
|
|
|
|
|
|
|
return $self->_parent->http_get( $uri ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub fetch_meta { |
36
|
|
|
|
|
|
|
my $self = shift; |
37
|
|
|
|
|
|
|
my $yaml = $self->fetch_source_file( 'META.yml' ); |
38
|
|
|
|
|
|
|
return YAML::XS::Load( $yaml ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub fetch_readme { |
42
|
|
|
|
|
|
|
my $self = shift; |
43
|
|
|
|
|
|
|
return $self->fetch_source_file( 'README' ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub fetch_changes { |
47
|
|
|
|
|
|
|
my $self = shift; |
48
|
|
|
|
|
|
|
return $self->fetch_source_file( 'Changes' ) |
49
|
|
|
|
|
|
|
|| $self->fetch_source_file( 'Changelog' ) |
50
|
|
|
|
|
|
|
|| $self->fetch_source_file( 'CHANGELOG' ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub fetch_todo { |
54
|
|
|
|
|
|
|
my $self = shift; |
55
|
|
|
|
|
|
|
return $self->fetch_source_file( 'TODO' ) |
56
|
|
|
|
|
|
|
|| $self->fetch_source_file( 'Todo' ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub fetch_tarball { |
60
|
|
|
|
|
|
|
# TODO: |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub data { |
64
|
|
|
|
|
|
|
my $self = shift; |
65
|
|
|
|
|
|
|
return { |
66
|
|
|
|
|
|
|
name => $self->name, |
67
|
|
|
|
|
|
|
version_name => $self->version_name, |
68
|
|
|
|
|
|
|
version => $self->version, |
69
|
|
|
|
|
|
|
maturity => $self->maturity, |
70
|
|
|
|
|
|
|
filename => $self->filename, |
71
|
|
|
|
|
|
|
cpanid => $self->cpanid, |
72
|
|
|
|
|
|
|
extension => $self->extension, |
73
|
|
|
|
|
|
|
pathname => $self->pathname, |
74
|
|
|
|
|
|
|
source_path => $self->source_path, |
75
|
|
|
|
|
|
|
}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub to_string { |
79
|
|
|
|
|
|
|
return encode_json( $_[0]->data ); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |