File Coverage

blib/lib/MyCPAN/Indexer/Tutorial.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package MyCPAN::Indexer::Tutorial;
2 1     1   1827 use strict;
  1         3  
  1         37  
3 1     1   6 use warnings;
  1         3  
  1         34  
4              
5 1     1   5 use vars qw($VERSION);
  1         2  
  1         111  
6             $VERSION = '1.28_12';
7              
8             =head1 NAME
9              
10             MyCPAN::Indexer::Tutorial - How the backpan_indexer.pl pieces fit together
11              
12             =head1 DESCRIPTION
13              
14             The C system lets you plug in different components to
15             control major portions of the process of examining Perl distributions
16             and collating the results. It's up to each component to obey its
17             interface and do that parts the other components expect it to do. The
18             idea is to decouple some of these bits as much as possible.
19              
20             As C does its work, it stores information about
21             its components in an anonymous hash called C. The different
22             components have access to this hash. (To Do: this is some pretty bad
23             design smell, but that's how it is right now).
24              
25             Specific implementations will impose other requirements not listed
26             in this tutorial.
27              
28             =head1 The Application
29              
30             The application is the bit that you write when you want to do
31             something very specialized with a different process. The application
32             object controls the environment, setting up the configuration, and other
33             application-level type things.
34              
35             See C, the module version, and
36             C, the script version.
37              
38             =head1 The Coordinator
39              
40             The coordinator is just a way for the components to talk to each
41             other. The application starts up, creates a coordinator object, and
42             stores it. The application gives a reference to the coordinator to
43             every component.
44              
45             When the application creates components, it tells each about the
46             coordinator. Each component can talk to the coordinator to get to
47             parts of the application it doesn't directly know about. Each
48             component tells the coordinator about itself so the coordinator can
49             talk to any component.
50              
51             The coordinator also maintains the "notes", which are arbitrary bits
52             of information that components use to pass information around. The
53             notes are like a scratch pad where components can leave information
54             for other components.
55              
56             See C.
57              
58             =head1 Components
59              
60             =head1 The Indexer class
61              
62             Most of the work to examine a Perl distribution is in
63             C. When it gets down to it, everything C
64             knows about Perl distributions is in there. It has a C method
65             which handles the examination. It kicks off C, which figures
66             out what to do by getting a list of steps from C.
67              
68             This technique is common throughout C. One method
69             returns a list of methods to run. This way, a subclass can control the
70             process by overriding the method that returns the steps.
71              
72             The basic class is C, but
73             C is an example of another indexing
74             class.
75              
76             Implements:
77              
78             get_indexer()
79              
80             Creates in C:
81              
82             indexer_callback - a sub reference that wraps its run routine
83              
84             Expects in C:
85              
86             nothing
87              
88             =head2 The Queue class
89              
90             The Queue class is responsible for getting the list of distributions to
91             process.
92              
93             C calls C and passes it a ConfigReader::Simple
94             object. C does whatever it needs to do, then returns an array
95             reference of file paths to process. Each path should represent a single
96             Perl distribution.
97              
98             Implements:
99              
100             get_queue()
101              
102             Creates in C:
103              
104             queue - a reference to the array reference returned by get_queue.
105              
106             Expects in C:
107              
108             nothing
109              
110             To Do: The Queue class should really be an iterator of some sort. Instead
111             of returning an array (which it can't change), return an iterator.
112              
113             =head2 The Worker class
114              
115             The Worker class returns the anonymous subroutine that the interface
116             class calls for each of its cycles. Inside that code reference, do the
117             actual indexing work, including saving the results.
118             C calls C with a reference to its
119             C hash.
120              
121             Implements:
122              
123             get_task()
124              
125             Creates in C
126              
127             child_task - a reference to the code reference returned by get_task.
128              
129             Expects in C
130              
131             nothing
132              
133             To Do: There should be a storage class which the worker class hands
134             the results to.
135              
136             =head2 The Reporter class
137              
138             The Reporter class implements the bits to store the result of the
139             Worker class. C calls C with a
140             reference to its C hash.
141              
142             Implements:
143              
144             get_reporter( $info )
145              
146             Creates in C:
147              
148             reporter - the code ref to handle storing the information
149              
150             Expects in C:
151              
152             nothing
153              
154             Expects in config:
155              
156             nothing
157              
158             =head2 The Dispatcher class
159              
160             The Dispatcher class implements the bits to hand out work to the
161             worker class. The Interface class, discussed next, repeatedly calls
162             the interface_callback code ref the Dispatcher class provides.
163              
164             Implements:
165              
166             get_dispatcher()
167              
168             Creates in C
169              
170             dispatcher - the dispatcher object, with start and finish methods
171             interface_callback - a code ref to call repeatedly in the Interface class
172              
173             Expects in C
174              
175             child_task - the code ref that handles indexing a single dist
176             queue - the array ref of dist paths
177              
178             =head2 The Collator class
179              
180             After the Dispatcher class finishes its queue of work, the Collator class
181             comes in and does something with the collection of reports.
182              
183             Implements:
184              
185             get_collator()
186              
187             Creates in C
188              
189             collator - a subroutine reference
190              
191             Expects in C
192              
193             nothing
194              
195             =head2 The Interface class
196              
197             The Interface class really has two jobs. It makes the live reporting
198             interface while C runs, at it repeatedly calls
199             the dispatcher to start new work.
200              
201             Implements:
202              
203             do_interface()
204              
205             Creates in C:
206              
207             nothing
208              
209             Expects in C
210              
211             interface_callback - a code ref to call repeatedly in the Interface class
212              
213             =head1 SEE ALSO
214              
215             MyCPAN::Indexer
216              
217             =head1 SOURCE AVAILABILITY
218              
219             This code is in Github:
220              
221             git://github.com/briandfoy/mycpan-indexer.git
222              
223             =head1 AUTHOR
224              
225             brian d foy, C<< >>
226              
227             =head1 COPYRIGHT AND LICENSE
228              
229             Copyright (c) 2008-2013, brian d foy, All Rights Reserved.
230              
231             You may redistribute this under the same terms as Perl itself.
232              
233             =cut
234              
235             1;