File Coverage

blib/lib/MyCPAN/Indexer/NullTester.pm
Criterion Covered Total %
statement 17 35 48.5
branch n/a
condition n/a
subroutine 7 22 31.8
pod 7 8 87.5
total 31 65 47.6


line stmt bran cond sub pod time code
1             package MyCPAN::Indexer::NullTester;
2 1     1   1831 use strict;
  1         2  
  1         35  
3 1     1   6 use warnings;
  1         2  
  1         30  
4              
5 1     1   6 use parent qw(MyCPAN::Indexer::Component);
  1         2  
  1         5  
6 1     1   69 use vars qw($VERSION $logger);
  1         2  
  1         64  
7             $VERSION = '1.28_12';
8              
9 1     1   6 use Log::Log4perl;
  1         2  
  1         7  
10              
11             BEGIN {
12 1     1   58 $logger = Log::Log4perl->get_logger( __PACKAGE__ );
13             }
14              
15             =head1 NAME
16              
17             MyCPAN::Indexer::NullTester - Do nothing components
18              
19             =head1 SYNOPSIS
20              
21             Use this in backpan_indexer.pl by specifying it as the class you
22             want to do nothing:
23              
24             # in backpan_indexer.config
25             worker_class MyCPAN::Indexer::NullTester
26              
27             =head1 DESCRIPTION
28              
29             This class implements all of the methods needed by all of the
30             component classes. Thes methods don't do anything, so they can be
31             useful to ignore parts of the system while you focus on developing
32             another. For instance, you might use this module as the
33             reporter_class, since it does nothing, which you work on the
34             dispatcher_class.
35              
36             =head2 Methods
37              
38             =over 4
39              
40             =item component_type
41              
42             This is a composite component, although you don't have to use all of them
43             at the same time.
44              
45             =cut
46              
47             sub component_type
48             {
49 0           $_[0]->combine_types(
50 0     0 1   map { my $m = "${_}_type"; $_[0]->$m() }
  0            
51             qw(indexer queue worker dispatcher reporter interface)
52             );
53             }
54              
55             =item Indexer class: get_indexer( HASH_REF )
56              
57             C adds a C key to HASH_REF. The value of
58             C is a no-op subroutine.
59              
60             The C subroutine is a no-op too.
61              
62             =cut
63              
64 0     0 1   sub get_indexer { $_[0]->set_note( 'indexer_callback', sub { 1 } ) }
  0     0      
65 0     0 0   sub run { 1 }
66              
67             =item Queue class: get_queue( HASH_REF )
68              
69             C adds a C key to HASH_REF. The value of
70             C is an empty
71              
72             =cut
73              
74 0     0 1   sub get_queue { $_[0]->set_note( 'queue', [] ) }
75              
76             =item Worker class: get_task( HASH_REF )
77              
78             C adds a C key to HASH_REF. The value of
79             C is a code reference that returns 1 and does nothing else.
80              
81             =cut
82              
83 0     0 1   sub get_task { $_[0]->set_note( 'child_task', sub { 1 } ) }
  0     0      
84              
85             =item Reporter class: get_reporter( HASH_REF )
86              
87             C adds a C key to HASH_REF. The value of
88             C is a code reference that returns 1 and does nothing else.
89              
90             =cut
91              
92 0     0 1   sub get_reporter { $_[0]->set_note( 'reporter', sub { 1 } ) }
  0     0      
93              
94             =item Dispatcher class: get_dispatcher()
95              
96             C adds a dispatcher key to HASH_REF. The value is an
97             object that responds to the start and finish methods, but does
98             nothing. C also sets the C key to
99             a code reference that returns 1 and does nothing else.
100              
101             =cut
102              
103 1     1   809 BEGIN {
104             package MyCPAN::Indexer::NullTester::Dispatcher;
105 0     0     sub new { bless '', $_[0] }
106 0     0     sub start { 1 };
107 0     0     sub finish { 1 };
108             }
109              
110             sub get_dispatcher
111             {
112 0     0 1   $_[0]->set_note('child_task', MyCPAN::Indexer::NullTester::Dispatcher->new );
113 0     0     $_[0]->set_note('interface_callback', sub { 1 } );
  0            
114             }
115              
116             =item Interface class: do_interface( HASH_REF )
117              
118             C simly returns 1.
119              
120             =cut
121              
122 0     0 1   sub do_interface { 1 }
123              
124             =back
125              
126             =head1 SEE ALSO
127              
128             MyCPAN::Indexer::Tutorial
129              
130             =head1 SOURCE AVAILABILITY
131              
132             This code is in Github:
133              
134             git://github.com/briandfoy/mycpan-indexer.git
135              
136             =head1 AUTHOR
137              
138             brian d foy, C<< >>
139              
140             =head1 COPYRIGHT AND LICENSE
141              
142             Copyright (c) 2008-2013, brian d foy, All Rights Reserved.
143              
144             You may redistribute this under the same terms as Perl itself.
145              
146             =cut
147              
148             1;