NAME

Ekorn::Pipeline::Element - what Ekorn's types are made from

SYNOPSIS

my $p = Ekorn::Pipeline->new(sub { uc });

$p->('a', 'b');           # called as a code reference
$p->call('a', 'b');       # the same, as a method

DESCRIPTION

Each of Ekorn's types is an element: a pipeline, a stage, a gather, a source, a sink and an iterator. An element is an object that can be called as a code reference, and what that does is each type's own: a pipeline runs the values it's given through its stages; an iterator hands out its next value.

An element holds the closure it's called as, and that closure never refers to the element itself. So an element is freed as soon as nothing else holds it, and an iterator let go ends its run there and then.

You needn't make an element, or know that one is: give Ekorn's types where they go. A part of your own that should work with Ekorn offers its role methods instead, as "Delivering parts for Ekorn" in Ekorn::Pipeline::Manual::Reference describes, and needn't be an element.

METHODS

call

$element->call(@arguments)

Calls the element with @arguments, as calling it as a code reference does, and returns what that returns.

SEE ALSO

Ekorn::Pipeline, Ekorn::Pipeline::Stage, Ekorn::Pipeline::Gather, Ekorn::Pipeline::Source, Ekorn::Pipeline::Sink and Ekorn::Pipeline::Iterator

AUTHOR

Iain Campbell <cpanic@cpan.org>

LICENSE

Copyright (c) 2024-2026 by Iain Campbell.

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