File Coverage

blib/lib/MyCPAN/Indexer/Queue/FromList.pm
Criterion Covered Total %
statement 16 31 51.6
branch 0 4 0.0
condition n/a
subroutine 6 7 85.7
pod n/a
total 22 42 52.3


line stmt bran cond sub pod time code
1             package MyCPAN::Indexer::Queue::FromList;
2 1     1   1294 use strict;
  1         3  
  1         40  
3 1     1   6 use warnings;
  1         2  
  1         31  
4              
5 1     1   6 use parent qw(MyCPAN::Indexer::Queue);
  1         3  
  1         7  
6 1     1   66 use vars qw($VERSION $logger);
  1         3  
  1         77  
7             $VERSION = '1.28_12';
8              
9 1     1   7 use Log::Log4perl;
  1         2  
  1         7  
10              
11             BEGIN {
12 1     1   64 $logger = Log::Log4perl->get_logger( 'Queue' );
13             }
14              
15             =head1 NAME
16              
17             MyCPAN::Indexer::Queue::FromList - Try to index distributions listed in a file
18              
19             =head1 SYNOPSIS
20              
21             Use this in backpan_indexer.pl by specifying it as the queue class:
22              
23             # in backpan_indexer.config
24             queue_class MyCPAN::Indexer::Queue::FromList
25              
26             =head1 DESCRIPTION
27              
28             This class returns a list of Perl distributions for the BackPAN
29             indexer to process. It selects the distributions that had previous
30             indexing errors by extracting the distribution path from the error
31             report. If the distribution isn't in the same place it was during
32             the original indexing, it won't be in the queue.
33              
34             =over
35              
36             =cut
37              
38             sub _get_file_list
39             {
40 0     0     my( $self ) = @_;
41              
42 0           my $file = $self->get_config->distribution_list;
43 0           $logger->debug( "Taking dists from [$file]" );
44 0 0         $logger->error( "Distribution file [$file] does not exist" )
45             unless -e $file;
46              
47 0           chomp( my @files = do { local( @ARGV ) = $file; <> } );
  0            
  0            
48 0           $logger->debug( "Found " . @files . " error reports" );
49              
50 0           my @queue;
51 0           foreach my $file ( @files )
52             {
53 0           $logger->debug( "Looking for distribution [$file]" );
54 0 0         if( -e $file )
55             {
56 0           push @queue, $file;
57             }
58             else
59             {
60 0           $logger->error( "Could not find [$file]: not adding to queue" );
61             }
62             }
63              
64 0           return \@queue;
65             }
66              
67             1;
68              
69             =back
70              
71             =head1 SEE ALSO
72              
73             MyCPAN::Indexer, MyCPAN::Indexer::Tutorial, MyCPAN::Indexer::Queue
74              
75             =head1 SOURCE AVAILABILITY
76              
77             This code is in Github:
78              
79             git://github.com/briandfoy/mycpan-indexer.git
80              
81             =head1 AUTHOR
82              
83             brian d foy, C<< >>
84              
85             =head1 COPYRIGHT AND LICENSE
86              
87             Copyright (c) 2010-2013, brian d foy, All Rights Reserved.
88              
89             You may redistribute this under the same terms as Perl itself.
90              
91             =cut