| 1 | package Labyrinth::Plugin::CPAN::Distros; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 4 | $VERSION = '3.59'; | |||||||||||||||||||||||||||
| 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 | ▶ | use base qw(Labyrinth::Plugin::Base); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 4 | ▶ | use Labyrinth::Audit; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 4 | ▶ | use Labyrinth::DBUtils; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 4 | ▶ | use Labyrinth::DTUtils; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 4 | ▶ | use Labyrinth::Plugin::CPAN; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 4 | ▶ | use Labyrinth::Variables; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | 4 | ▶ | use Labyrinth::Writer; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 4 | ▶ | use JSON::XS; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 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 | ▶ | ($tvars{letter}) = ($cgiparams{name} =~ /^([A-Z])/i); | ||||||||||||||||||||||||||
|
Subroutine
List: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 52 | 0 | $tvars{letter} = uc $tvars{letter}; | |||||||||||||||||||||||||||
| 53 | 0 | ▶ | return unless($tvars{letter}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | my @rows = $dbi->GetQuery('hash','GetDistros',"$tvars{letter}%"); | |||||||||||||||||||||||||||
| 56 | 0 | my @dists = map {$_->{dist}} @rows; | |||||||||||||||||||||||||||
| 57 | 0 | ▶ | $tvars{list} = \@dists if(@dists); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | sub Reports { | ||||||||||||||||||||||||||||
| 61 | 0 | ▶ | my $cpan = Labyrinth::Plugin::CPAN->new(); | ||||||||||||||||||||||||||
|
Subroutine
Reports: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||
| 62 | 0 | $cpan->Configure(); | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | my $symlinks = $cpan->symlinks(); | |||||||||||||||||||||||||||
| 65 | 0 | ▶ | $cgiparams{name} = $symlinks->{$cgiparams{name}} if($symlinks->{$cgiparams{name}}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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 | ▶ | unless(@rows) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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 | ▶ | unless(@summary) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | 0 | ▶ | unless($settings{crawler}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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 | ▶ | if(@rows && $rows[0]->[0] > 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@rows and $rows[0][0] > 0
MC/DC0%0/2
@rows and $rows[0][0] > 0
@rows
$rows[0][0] > 0
Truth table0%0/3
A and B
A= @rowsB= $rows[0][0] > 0
| |||||||||||||||||||||||||||||
| 93 | 0 | ▶ | unless($settings{crawler}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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}; } | |||||||||||||||||||||||||||
| 102 | 0 | ▶ | $tvars{processed} = formatDate(8,$parms->{processed}) if($parms->{processed}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 4 | 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 | ||||||||||||||||||||||||||||