Indexer/Queue/NewFiles.pm

filter: Statementstmt 82.5% 33 / 40 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 91.6% 11 / 12 Podpod n/a totaltotal 77.1% 44 / 57 CC 2 SCAR 5.7
CC
2
Cov
77%
_get_file_list
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« Indexer/Component.pm ↑ Summary Indexer/Coordinator.pm »
1 package MyCPAN::Indexer::Queue::ModifiedSince;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use parent qw(MyCPAN::Indexer::Queue);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use vars qw($VERSION $logger);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 $VERSION = '1.282';
8  
9 1 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use File::Find;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use File::Find::Closures qw( find_by_regex );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use File::Path qw( mkpath );
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use File::Spec::Functions qw( catfile rel2abs );
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Log::Log4perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 $logger = Log::Log4perl->get_logger( 'Queue' );
18 }
19  
20 =encoding utf8
21  
22 =head1 NAME
23  
24 MyCPAN::Indexer::Queue - Find distributions to index
25  
26 =head1 SYNOPSIS
27  
28 Use this in backpan_indexer.pl by specifying it as the queue class:
29  
30 # in backpan_indexer.config
31 queue_class MyCPAN::Indexer::Queue::ModifiedSince
32  
33 =head1 DESCRIPTION
34  
35 This class returns a list of Perl distributions for the BackPAN
36 indexer to process. It returns from the backpan directories the
37 files modified in the last day (not yet configurable).
38  
39 =head2 Methods
40  
41 =over 4
42  
43 =item get_queue
44  
45 C<get_queue> sets the key C<queue> in C<$Notes> hash reference. It
46 finds all of the tarballs or zip archives in under the directories
47 named in C<backpan_dir> and C<merge_dirs> in the configuration.
48  
49 It specifically skips files that end in C<.txt.gz> or C<.data.gz>
50 since PAUSE creates those meta files near the actual module
51 installations.
52  
53 If the C<organize_dists> configuration value is true, it also copies
54 any distributions it finds into a PAUSE-like structure using the
55 value of the C<pause_id> configuration to create the path.
56  
57 =cut
58  
59 sub _get_file_list
60 0 ▶ {
Subroutine _get_file_list: not called CC=2 SCAR=17.9
61 0 my( $self, @dirs ) = @_;
62  
63 0 $logger->debug( "Taking dists from [@dirs]" );
64 0 my( $wanted, $reporter ) =
65 File::Find::Closures::find_by_modified_after( time - 24*60*60 );
66  
67 0 find( $wanted, @dirs );
68  
69 return [
70 0 map { rel2abs($_) }
71 0 ▶ grep { ! /.(data|txt).gz$/ and ! /02packages/ }
Condition0%0/3
/.(data|txt).gz$/ || /02packages/
l!l&&r!l&&!r
000
MC/DC0%0/2
/.(data|txt).gz$/ || /02packages/
/.(data|txt).gz$/ /02packages/
Truth table0%0/3
A || B
A= /.(data|txt).gz$/B= /02packages/
ABresult
1X1
011
000
72 $reporter->()
73 ];
74  
75 }
76  
77 1 1;
78  
79 =back
80  
81 =head1 SEE ALSO
82  
83 MyCPAN::Indexer, MyCPAN::Indexer::Tutorial
84  
85 =head1 SOURCE AVAILABILITY
86  
87 This code is in Github:
88  
89 git://github.com/briandfoy/mycpan-indexer.git
90  
91 =head1 AUTHOR
92  
93 brian d foy, C<< <bdfoy@cpan.org> >>
94  
95 =head1 COPYRIGHT AND LICENSE
96  
97 Copyright © 2008-2018, brian d foy <bdfoy@cpan.org>. All rights reserved.
98  
99 You may redistribute this under the terms of the Artistic License 2.0.
100  
101 =cut
« Indexer/Component.pm ↑ Summary Indexer/Coordinator.pm »