NAME
Pipeline - Generic pipeline interface
SYNOPSIS
use Pipeline;
my $pipeline = Pipeline->new();
$pipeline->add_segment( @segments );
$pipeline->dispatch();
DESCRIPTION
"Pipelines" are a mechanism to process data. They are designed to be
plugged together to make fairly complex operations act in a fairly
straightforward manner, cleanly, and simply.
USING THE PIPELINE MODULE
The usage of the generic pipeline module is fairly simple. You
instantiate a Pipeline object by using the *new()* constructor.
Segments can be added to the pipeline with the add_segment method.
The store that the Pipeline will use can be set by calling the *store()*
method later on. If a store is not set by the time a pipeline is
executing then it will use a store of the type "Pipeline::Store::Simple"
To start the pipeline running call the *dispatch()* method on your
Pipeline object.
To see what is being dispatched within a pipeline dispatch set the
pipeline's debug value to true.
WRITING A PIPELINE
INHERITANCE
Pipelines are designed to be inherited from. The inheritance tree is
somewhat warped and should look a little like this:
MySegment --> Pipeline::Segment <--- Pipeline
In other words, everything is a pipeline segment.
METHODS
The Pipeline class inherits from the "Pipeline::Segment" class and
therefore also has any additional methods that its superclass may have.
init( @_ )
Things to do at construction time. If you do override this, it will
often be fairly important that you call $self->SUPER::init(@_) to
make sure that the setup is done correctly. Returns itself on
success, undef on failure.
add_segment( LIST )
Adds a segment or segments to the pipeline. Returns itself.
get_segment( INTEGER )
Returns the segment located at the index specified by INTEGER
del_segment( INTEGER )
Deletes and returns the segment located at the index specified by
INTEGER
dispatch()
Starts the pipeline execution, returns the production or undef
dispatch_loop( Pipeline, [ ARRAYREF ] )
The "dispatch_loop" method performs the processing for the pipeline
dispatch_segment( Pipeline::Segment )
The "dispatch_segment" method handles the execution of an individual
segment object.
cleanups()
Returns the cleanup pipeline. This is a pipeline in and of itself,
and all the methods you can call on a pipeline can also be called on
this.
cleanup()
Calls the dispatch method on the cleanup pipeline.
segments( [ value ] )
"segments" gets and sets the value of the pipeline list. At
initialization this is set to an array reference.
debug_all( value )
Sets debug( value ) recursively for each segment in this pipeline.
SEE ALSO
"Pipeline::Segment", "Pipeline::Store", "Pipeline::Store::Simple"
"Pipeline::Production"
AUTHORS
James A. Duncan <
[email protected]>
Leon Brocard <
[email protected]>
COPYRIGHT
Copyright 2003 Fotango Ltd. Licensed under the same terms as Perl
itself.