Pipeline::Config - configuration files for building Pipelines.
use Error qw( :try ); use Pipeline::Config; my $config = Pipeline::Config->new(); try { my $pipe = $config->load( 'somefile.type' ); my $pipe2 = $config->load( 'somefile', 'type' ); } catch Error with { print shift; }
Pipeline::Config lets you specify the structure of a Pipeline in a configuration file. This means you don't have to use() every Segment, call its constructor, and add it to the pipeline, because Pipeline::Config does it for you. It also means the flow of logic through your Pipeline is in one place, in a format that is easily read.
"How nice", you say? Well, this all assumes you have relatively simple Pipeline Segments that don't need lots of configuration. If you don't, then maybe this module is not for you.
Pipeline::Config is the frontend to various types of pipeline configuration files.
Pipeline::Config
At the moment, only YAML is supported.
YAML
Get/set the hash of known pipeline config types & their class names. This is used to lookup & load config classes. If you write your own config parser you should register it like this:
Pipeline::Config->types->{type} => 'MyConfig::Type';
Load the config file given. Currently $file must be a valid path (file handles and text references are not yet supported). If $type is not passed, attempts to resolve it by seeing if the filename's suffix matches any of the known types listed in $class->types().
Throws a Pipeline::Config::UnknownTypeError if the type could not be resolved, or a Pipeline::Config::LoadError if there was an error loading the config file.
Pipeline::Config::UnknownTypeError
Pipeline::Config::LoadError
Here's an example YAML config file:
# Pipeline configuration file --- search-packages: - MyApp::Segment pipeline: - MyApp::Segment::Foo # you don't have to name segments explicitly # if you're using search-packages: - Foo - this is a sub pipe: # anything with the word 'pipe' creates a new Pipeline # named sub-pipes are not yet supported - another sub pipe: - DeclineNoBar - GetDrink # this calls the 'foo' method with 'bar' as an argument: - Baz: { foo: "bar" } - AnotherApp::Segment::GoFish cleanups: # if you really need to, set cleanup segments here... - Cleanup::Segment
Steve Purkis <spurkis@epn.nu>
Copyright (c) 2003 Steve Purkis. All rights reserved. Released under the same license as Perl itself.
Pipeline
To install Pipeline::Config, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pipeline::Config
CPAN shell
perl -MCPAN -e shell install Pipeline::Config
For more information on module installation, please visit the detailed CPAN module installation guide.