NAME

MyCPAN::Indexer::Component - base class for MyCPAN components

SYNOPSIS

package MyCPAN::Indexer::NewComponent;

use base qw(MyCPAN::Indexer::Component);

sub component_type { $_[0]->reporter_type }

DESCRIPTION

This module implements features common to all MyCPAN::Indexer components. Each component is able to communicate with a coordinator object to find out the results and notes left by other components. Most of that delegation infrastructure is hidden since each component can call methods on its own instances that this module dispatches appropriately.

Methods

new( [COORDINATOR] )

Create a new component object. This is mostly to have a place to store a reference to the coordinator object. See get_coordinator.

get_coordinator

Get the coordinator object. This is the object that coordinates all of the components. Each component communicates with the coordinator and other components can see it.

set_coordinator( $coordinator )

Set the coordinator object. new already does this for you if you pass it a coordinator object. Each component expects the cooridnator object to respond to these methods:

get_info
set_info
get_note
set_note
get_config
set_config
increment_note
decrement_note
push_onto_note
unshift_onto_note
get_note_list_element
set_note_unless_defined
null_type
collator_type
dispatcher_type
indexer_type
interface_type
queue_type
reporter_type
worker_type

Returns the magic number that identifies the component type. You shouldn't ever have to look at the particular number. Some components might have several types.

combine_types( TYPES )

For components that implement several roles, create a composite type:

my $custom_type = $self->combine_types(
	map { $self->$_() } qw( queue_type worker_type );
	}

If you want to test that value, use the is_type methods.

is_type( CONCRETE, TEST )

Tests a CONCRETE type (the one a component claims to be) with the TYPE that you want to check. This is the general test.

is_null_type
is_collator_type
is_dispatcher_type
is_indexer_type
is_interface_type
is_queue_type
is_reporter_type
is_worker_type

These are curried versions of is_type. They should be a bit easier to use.

SOURCE AVAILABILITY

This code is in Github:

git://github.com/briandfoy/mycpan-indexer.git

AUTHOR

brian d foy, <bdfoy@cpan.org>

COPYRIGHT AND LICENSE

Copyright (c) 2008-2013, brian d foy, All Rights Reserved.

You may redistribute this under the same terms as Perl itself.