line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Labyrinth::Plugin::CPAN::Distros; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
37803
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
119
|
|
4
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
117
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
22
|
use vars qw($VERSION); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
207
|
|
7
|
|
|
|
|
|
|
$VERSION = '3.58'; |
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
|
|
25
|
use base qw(Labyrinth::Plugin::Base); |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
647
|
|
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
4
|
|
852726
|
use Labyrinth::Audit; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
498
|
|
21
|
4
|
|
|
4
|
|
26
|
use Labyrinth::DBUtils; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
70
|
|
22
|
4
|
|
|
4
|
|
42
|
use Labyrinth::DTUtils; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
238
|
|
23
|
4
|
|
|
4
|
|
439
|
use Labyrinth::Plugin::CPAN; |
|
4
|
|
|
|
|
11800
|
|
|
4
|
|
|
|
|
27
|
|
24
|
4
|
|
|
4
|
|
124
|
use Labyrinth::Variables; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
471
|
|
25
|
4
|
|
|
4
|
|
28
|
use Labyrinth::Writer; |
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
194
|
|
26
|
|
|
|
|
|
|
|
27
|
4
|
|
|
4
|
|
22
|
use JSON::XS; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
1707
|
|
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
|
0
|
0
|
|
|
|
|
unless($settings{crawler}) { |
82
|
0
|
|
|
|
|
|
$dbi->DoQuery('PushDistro',$cgiparams{name}); |
83
|
0
|
|
|
|
|
|
$tvars{update} = 1; |
84
|
|
|
|
|
|
|
} |
85
|
0
|
|
|
|
|
|
$tvars{perlvers} = $cpan->mklist_perls; |
86
|
0
|
|
|
|
|
|
$tvars{osnames} = $cpan->osnames; |
87
|
0
|
|
|
|
|
|
return; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# if existing page requests, add another to improve rebuild time |
91
|
0
|
|
|
|
|
|
@rows = $dbi->GetQuery('array','GetDistroRequests',$cgiparams{name}); |
92
|
0
|
0
|
0
|
|
|
|
if(@rows && $rows[0]->[0] > 0) { |
93
|
0
|
0
|
|
|
|
|
unless($settings{crawler}) { |
94
|
0
|
|
|
|
|
|
$dbi->DoQuery('PushDistro',$cgiparams{name}); |
95
|
0
|
|
|
|
|
|
$tvars{update} = 1; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# decode from JSON string |
100
|
0
|
|
|
|
|
|
my $parms = decode_json($summary[0]->{dataset}); |
101
|
0
|
|
|
|
|
|
for my $key (keys %$parms) { $tvars{$key} = $parms->{$key}; } |
|
0
|
|
|
|
|
|
|
102
|
0
|
0
|
|
|
|
|
$tvars{processed} = formatDate(8,$parms->{processed}) if($parms->{processed}); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
__END__ |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 SEE ALSO |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Labyrinth |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Barbie, <barbie@missbarbell.co.uk> for |
116
|
|
|
|
|
|
|
Miss Barbell Productions, L<http://www.missbarbell.co.uk/> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Copyright (C) 2008-2017 Barbie for Miss Barbell Productions |
121
|
|
|
|
|
|
|
All Rights Reserved. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or |
124
|
|
|
|
|
|
|
modify it under the Artistic License 2.0. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |