line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Labyrinth::Plugin::CPAN::Distros; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
15484
|
use strict; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
146
|
|
4
|
4
|
|
|
4
|
|
24
|
use warnings; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
135
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
22
|
use vars qw($VERSION); |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
223
|
|
7
|
|
|
|
|
|
|
$VERSION = '3.60'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Labyrinth::Plugin::CPAN::Distros - Plugin to handle Distribution pages. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
#---------------------------------------------------------------------------- |
16
|
|
|
|
|
|
|
# Libraries |
17
|
|
|
|
|
|
|
|
18
|
4
|
|
|
4
|
|
26
|
use base qw(Labyrinth::Plugin::Base); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
347
|
|
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
4
|
|
28
|
use Labyrinth::Audit; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
645
|
|
21
|
4
|
|
|
4
|
|
29
|
use Labyrinth::DBUtils; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
107
|
|
22
|
4
|
|
|
4
|
|
20
|
use Labyrinth::DTUtils; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
318
|
|
23
|
4
|
|
|
4
|
|
40
|
use Labyrinth::Plugin::CPAN; |
|
4
|
|
|
|
|
24
|
|
|
4
|
|
|
|
|
34
|
|
24
|
4
|
|
|
4
|
|
124
|
use Labyrinth::Variables; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
640
|
|
25
|
4
|
|
|
4
|
|
31
|
use Labyrinth::Writer; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
231
|
|
26
|
|
|
|
|
|
|
|
27
|
4
|
|
|
4
|
|
24
|
use JSON::XS; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
5352
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#---------------------------------------------------------------------------- |
30
|
|
|
|
|
|
|
# Public Interface Functions |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 METHODS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 Public Interface Methods |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=over 4 |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item List |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
List distributions for a given letter. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item Reports |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
List reports for a distribution. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=back |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub List { |
51
|
0
|
|
|
0
|
1
|
|
($tvars{letter}) = ($cgiparams{name} =~ /^([A-Z])/i); |
52
|
0
|
|
|
|
|
|
$tvars{letter} = uc $tvars{letter}; |
53
|
0
|
0
|
|
|
|
|
return unless($tvars{letter}); |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my @rows = $dbi->GetQuery('hash','GetDistros',"$tvars{letter}%"); |
56
|
0
|
|
|
|
|
|
my @dists = map {$_->{dist}} @rows; |
|
0
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
$tvars{list} = \@dists if(@dists); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub Reports { |
61
|
0
|
|
|
0
|
1
|
|
my $cpan = Labyrinth::Plugin::CPAN->new(); |
62
|
0
|
|
|
|
|
|
$cpan->Configure(); |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $symlinks = $cpan->symlinks(); |
65
|
0
|
0
|
|
|
|
|
$cgiparams{name} = $symlinks->{$cgiparams{name}} if($symlinks->{$cgiparams{name}}); |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$tvars{distribution} = $cgiparams{name}; |
68
|
0
|
|
|
|
|
|
$tvars{letter} = substr($cgiparams{name},0,1); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# does author exist? |
71
|
0
|
|
|
|
|
|
my @rows = $dbi->GetQuery('hash','FindDistro',{dist => $cgiparams{name}}); |
72
|
0
|
0
|
|
|
|
|
unless(@rows) { |
73
|
0
|
|
|
|
|
|
$tvars{errcode} = 'NEXT'; |
74
|
0
|
|
|
|
|
|
$tvars{command} = 'cpan-distunk'; |
75
|
0
|
|
|
|
|
|
return; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# get author summary |
79
|
0
|
|
|
|
|
|
my @summary = $dbi->GetQuery('hash','GetDistroSummary',$cgiparams{name}); |
80
|
0
|
0
|
|
|
|
|
unless(@summary) { |
81
|
|
|
|
|
|
|
# summary doesn't exist, request a build |
82
|
0
|
0
|
|
|
|
|
unless($settings{crawler}) { |
83
|
0
|
|
|
|
|
|
$dbi->DoQuery('PushDistro',$cgiparams{name}); |
84
|
0
|
|
|
|
|
|
$tvars{update} = 1; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
$tvars{perlvers} = $cpan->mklist_perls; |
88
|
0
|
|
|
|
|
|
$tvars{osnames} = $cpan->osnames; |
89
|
0
|
|
|
|
|
|
return; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# if existing page requests, add another to improve rebuild time |
93
|
0
|
|
|
|
|
|
@rows = $dbi->GetQuery('array','GetDistroRequests',$cgiparams{name}); |
94
|
0
|
0
|
0
|
|
|
|
if(@rows && $rows[0]->[0] > 0) { |
95
|
0
|
0
|
|
|
|
|
unless($settings{crawler}) { |
96
|
0
|
|
|
|
|
|
$dbi->DoQuery('PushDistro',$cgiparams{name}); |
97
|
0
|
|
|
|
|
|
$tvars{update} = 1; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# decode from JSON string |
102
|
0
|
|
|
|
|
|
my $parms = decode_json($summary[0]->{dataset}); |
103
|
0
|
|
|
|
|
|
for my $key (keys %$parms) { $tvars{$key} = $parms->{$key}; } |
|
0
|
|
|
|
|
|
|
104
|
0
|
0
|
|
|
|
|
$tvars{processed} = formatDate(8,$parms->{processed}) if($parms->{processed}); |
105
|
0
|
|
|
|
|
|
$tvars{perlvers} = $cpan->mklist_perls; |
106
|
0
|
|
|
|
|
|
$tvars{osnames} = $cpan->osnames; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
__END__ |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SEE ALSO |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Labyrinth |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 AUTHOR |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Barbie, <barbie@missbarbell.co.uk> for |
120
|
|
|
|
|
|
|
Miss Barbell Productions, L<http://www.missbarbell.co.uk/> |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Copyright (C) 2008-2017 Barbie for Miss Barbell Productions |
125
|
|
|
|
|
|
|
All Rights Reserved. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or |
128
|
|
|
|
|
|
|
modify it under the Artistic License 2.0. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |