NAME

Zing::Flow - Loop Step

ABSTRACT

Event-Loop Logic Chain

SYNOPSIS

use Zing::Flow;

my $flow = Zing::Flow->new(name => 'step_1', code => sub {1});

# $flow->execute;

DESCRIPTION

This package provides represents an event-loop step, it is implemented as a simplified linked-list that allows other flows to be appended, prepended, and injected easily, anywhere in the flow.

LIBRARIES

This package uses type constraints from:

Zing::Types

ATTRIBUTES

This package has the following attributes:

code

code(CodeRef)

This attribute is read-only, accepts (CodeRef) values, and is required.

name

name(Str)

This attribute is read-only, accepts (Str) values, and is required.

next

next(Flow)

This attribute is read-write, accepts (Flow) values, and is optional.

METHODS

This package implements the following methods:

append

append(Flow $flow) : Flow

The append method appends the flow provided to the end of its chain.

append example #1
# given: synopsis

my $next = Zing::Flow->new(name => 'step_2', code => sub {2});

$flow->append($next);

bottom

bottom() : Flow

The bottom method returns the flow object at the end of its chain.

bottom example #1
# given: synopsis

$flow->bottom;
bottom example #2
# given: synopsis

my $next = Zing::Flow->new(name => 'step_2', code => sub {2});

$flow->next($next);

$flow->bottom;

execute

execute(Any @args) : Any

The execute method executes its code routine as a method call.

execute example #1
# given: synopsis

$flow->execute;

prepend

prepend(Flow $flow) : Flow

The prepend method prepends the flow provided by adding itself to the end of that chain and returns the flow object provided.

prepend example #1
# given: synopsis

my $base = Zing::Flow->new(name => 'step_0', code => sub {0});

$flow->prepend($base);

AUTHOR

Al Newkirk, awncorp@cpan.org

LICENSE

Copyright (C) 2011-2019, Al Newkirk, et al.

This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues