NAME

DataFlow::Chain - A "super-node" that can link a sequence of nodes

VERSION

version 0.91.05

SYNOPSIS

use DataFlow::Node;
use DataFlow::Chain;

my $chain = DataFlow::Chain->new(
    links => [
        DataFlow::Node->new(
            process_item => sub {
                shift; return uc(shift);
            }
        ),
        DataFlow::Node->new(
            process_item => sub {
                shift; return reverse shift ;
            }
        ),
    ],
);

my $result = $chain->process( 'abc' );
# $result == 'CBA'

DESCRIPTION

This is a Moose based class that provides the idea of a chain of steps in a data-flow. One might think of it as the actual definition of the data flow, but this is a limited, linear, flow, and there is room for a lot of improvements.

A DataFlow::Chain object accepts input like a regular DataFlow::Node, but it injects that input into the first link of the chain, and pumps the output of each link into the input of the next one, similarly to pipes in a shell command line. The output of the last link of the chain will be used as the output of the entire chain.

NAME

DataFlow::Chain - A "super-node" that can link a sequence of nodes

ATTRIBUTES

This attribute is a ArrayRef[DataFlow::Node], and it holds the actual "chain" of nodes to process the data.

METHODS

The interface for DataFlow::Chain is the same of DataFlow::Node, except for the accessor method for links.

DEPENDENCIES

DataFlow::Node

List::Util

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

Please report any bugs or feature requests to bug-dataflow@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Alexei Znamensky <russoz@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Alexei Znamensky.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.