The MyCPAN::Indexer system lets you plug in different components to control major portions of the process of examining Perl distributions and collating the results.
It's up to each component to obey its interface and do that parts the other components expect it to do.
The idea is to decouple some of these bits as much as possible.

As backpan_indexer.pl does its work,
it stores information about its components in an anonymous hash called notes.
The different components have access to this hash.
(To Do: this is some pretty bad design smell,
but that's how it is right now).

Specific implementations will impose other requirements not listed in this tutorial.

The coordinator is just a way for the components to talk to each other.
The application starts up,
creates a coordinator object,
and stores it.
The application gives a reference to the coordinator to every component.

When the application creates components,
it tells each of about the coordinator.
Each component can talk to the coordinator to get to parts of the application it doesn't directly know about.
Each component tells the coordinator about itself so the coordinator can talk to any component.

The coordinator maintains the "notes",
which are arbitrary bits of information that components use to pass information around.

Most of the work to examine a Perl distribution is in MyCPAN::Indexer.
When it gets down to it,
everything MyCPAN knows about Perl distributions is in there.
It has a run() method which handles the examination.
It kicks off examine,
which figures out what to do by getting a list of steps from examine_dist_steps.

This technique is common throughout MyCPAN::Indexer.
One method returns a list of methods to run.
This way,
a subclass can control the process by overriding the method that returns the steps.

The basic class is MyCPAN::Indexer,
but MyCPAN::Indexer::TestCensus is an example of another indexing class.

The Queue class is responsible for getting the list of distributions to process.

backpan_indexer.pl calls get_queue and passes it a ConfigReader::Simple object.
get_queue does whatever it needs to do,
then returns an array reference of file paths to process.
Each path should represent a single Perl distribution.

Implements:

get_queue()

Creates in notes:

queue - a reference to the array reference returned by get_queue.

Expects in notes:

nothing

To Do: The Queue class should really be an iterator of some sort. Instead of returning an array (which it can't change), return an iterator.

The Worker class returns the anonymous subroutine that the interface class calls for each of its cycles. Inside that code reference, do the actual indexing work, including saving the results. backpan_indexer.pl calls get_task with a reference to its notes hash.

Implements:

get_task()

Creates in notes

child_task - a reference to the code reference returned by get_task.

Expects in notes

nothing

To Do: There should be a storage class which the worker class hands the results to.