NAME
Pipeline - Generic pipeline interface
SYNOPSIS
use Pipeline;
my $pipeline = Pipeline->new(
store => Pipeline::Store::Simple->new(),
segments => [
Pipeline::Segment->new(),
Pipeline->new(
Pipeline::Segment->new(),
Pipeline::Segment->new(),
),
]
);
$pipeline->plugin( Pipeline::Segment->new() );
my $output = $pipeline->enter();
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.
USING THE PIPELINE MODULE
The usage of the generic pipeline module is fairly simple. You instantiate a Pipeline object by using the new() constructor.
Pipeline elements (segments or pipelines) can be added at construction time, by placing them in the segments array, or afterwards by using the plugin() method.
The store that the Pipeline will use can be set by using the store parameter to the constructor, or 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 enter() method on your Pipeline object.
WRITING A PIPELINE
The pipeline module is designed to be an interface that can be inherited from and implemented to meet the implementors requirements. In order to do so the pipeline architecture has to be fairly rigorously defined. A Pipeline is a collection of Segments. For most purposes redefinition of the enter() method in pipelines inheriting from the Pipeline module should not be needed. The most common method to redefine is the dispatch() method which handles idiosyncracies of individual segment types.
The generic enter() method calls the dispatch() method with the calling object (the Pipeline) and the element that it is calling to as its arguments. It is expected that segments requiring changes in dispatch semantics will be placed in separate pipelines inside the main pipeline, thus removing the need make the dispatch method overly complex.
Whenever the enter method is called - either on a Pipeline or a Pipeline Segment - the first argument is the message reciever (the calling object) and the second argument is the store.
AUTHOR
James A. Duncan <jduncan@fotango.com>
COPYRIGHT
Copyright 2002 Fotango Ltd. Licensed under the same terms as Perl itself.