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