line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::PGXN::Extension; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
113
|
use 5.8.1; |
|
9
|
|
|
|
|
31
|
|
|
9
|
|
|
|
|
447
|
|
4
|
9
|
|
|
9
|
|
57
|
use strict; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
630
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = v0.12.4; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
BEGIN { |
9
|
|
|
|
|
|
|
# Hash accessors. |
10
|
9
|
|
|
9
|
|
25
|
for my $k (qw( |
11
|
|
|
|
|
|
|
stable |
12
|
|
|
|
|
|
|
testing |
13
|
|
|
|
|
|
|
unstable |
14
|
|
|
|
|
|
|
)) { |
15
|
9
|
|
|
9
|
|
47
|
no strict 'refs'; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
685
|
|
16
|
27
|
100
|
|
4
|
|
120
|
*{"$k\_info"} = sub { +{ %{ shift->{$k} || {} } } }; |
|
27
|
|
|
|
|
6089
|
|
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
44
|
|
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
1
|
|
|
1
|
1
|
33
|
my ($class, $pgxn, $data) = @_; |
22
|
1
|
|
|
|
|
4
|
$data->{_pgxn} = $pgxn; |
23
|
1
|
|
|
|
|
7
|
bless $data, $class; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
1
|
9
|
sub name { shift->{extension} } |
27
|
1
|
|
|
1
|
1
|
5
|
sub latest { shift->{latest} } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub latest_info { |
30
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
31
|
2
|
|
|
|
|
6
|
return { %{ $self->{$self->{latest}} } }; |
|
2
|
|
|
|
|
23
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
1
|
1
|
5
|
sub stable_distribution { shift->_dist_for_status('stable') } |
35
|
1
|
|
|
1
|
1
|
5
|
sub testing_distribution { shift->_dist_for_status('testing') } |
36
|
1
|
|
|
1
|
1
|
3
|
sub unstable_distribution { shift->_dist_for_status('unstable') } |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub latest_distribution { |
39
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
40
|
1
|
|
|
|
|
4
|
$self->_dist_for_status($self->{latest}); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub distribution_for_version { |
44
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
45
|
2
|
50
|
|
|
|
6
|
my $vdata = $self->info_for_version(shift) or return; |
46
|
2
|
|
|
|
|
4
|
return $self->{_pgxn}->get_distribution(@{ $vdata->[0] }{qw(dist version)}); |
|
2
|
|
|
|
|
11
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub info_for_version { |
50
|
4
|
|
|
4
|
1
|
9
|
my ($self, $version) = @_; |
51
|
4
|
|
|
|
|
36
|
$self->{versions}{$version}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _dist_for_status { |
55
|
4
|
|
|
4
|
|
8
|
my ($self, $status) = @_; |
56
|
4
|
100
|
|
|
|
20
|
my $vdata = $self->{$status} or return; |
57
|
2
|
|
|
|
|
4
|
return $self->{_pgxn}->get_distribution(@{ $vdata }{qw(dist version)}); |
|
2
|
|
|
|
|
11
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub download_stable_to { |
61
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
62
|
1
|
|
|
|
|
6
|
$self->_download_to(shift, $self->{stable}); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub download_latest_to { |
66
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
67
|
1
|
|
|
|
|
6
|
$self->_download_to(shift, $self->latest_info); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub download_testing_to { |
71
|
1
|
|
|
1
|
1
|
5
|
my $self = shift; |
72
|
1
|
|
|
|
|
9
|
$self->_download_to(shift, $self->{testing}); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub download_unstable_to { |
76
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
77
|
1
|
|
|
|
|
9
|
$self->_download_to(shift, $self->{unstable}); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub download_version_to { |
81
|
2
|
|
|
2
|
1
|
6
|
my ($self, $version, $file) = @_; |
82
|
2
|
100
|
|
|
|
9
|
my $info = $self->info_for_version($version) or return; |
83
|
1
|
|
|
|
|
6
|
$self->_download_to($file, $info->[0]); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub _download_to { |
87
|
5
|
|
|
5
|
|
18
|
my ($self, $file, $info) = @_; |
88
|
5
|
100
|
|
|
|
29
|
return unless $info; |
89
|
3
|
|
|
|
|
32
|
$self->{_pgxn}->_download_to($file => { |
90
|
|
|
|
|
|
|
dist => $info->{dist}, |
91
|
|
|
|
|
|
|
version => $info->{version}, |
92
|
|
|
|
|
|
|
}); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |