Zing::Loop - Event Loop
Process Event Loop
use Zing::Flow; use Zing::Loop; my $loop = Zing::Loop->new( flow => Zing::Flow->new(name => 'init', code => sub {1}) );
This package provides represents the process event-loop, it is implemented as an infinite loop which executes Zing::Flow objects.
This package uses type constraints from:
Zing::Types
This package has the following attributes:
flow(Flow)
This attribute is read-only, accepts (Flow) values, and is required.
(Flow)
last(Bool)
This attribute is read-only, accepts (Bool) values, and is optional.
(Bool)
stop(Bool)
This package implements the following methods:
execute(Any @args) : Object
The execute method executes the event-loop indefinitely.
# given: synopsis $loop->execute;
exercise(Any @args) : Object
The exercise method executes the event-loop and stops after the first cycle.
# given: synopsis $loop->exercise;
package Loop; our $i = 0; my $flow_0 = Zing::Flow->new( name => 'flow_0', code => sub { my ($flow, $loop) = @_; $loop->stop(1); } ); my $flow_1 = $flow_0->next(Zing::Flow->new( name => 'flow_1', code => sub { my ($flow, $loop) = @_; $i++; } )); my $loop = Zing::Loop->new(flow => $flow_0); $loop->exercise;
package Loop; our $i = 0; my $flow_0 = Zing::Flow->new( name => 'flow_0', code => sub { my ($flow, $loop) = @_; $loop->last(1); } ); my $flow_1 = $flow_0->next(Zing::Flow->new( name => 'flow_1', code => sub { my ($flow, $loop) = @_; $i++; } )); my $loop = Zing::Loop->new(flow => $flow_0); $loop->exercise;
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
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".
Wiki
Project
Initiatives
Milestones
Contributing
Issues
To install Zing, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Zing
CPAN shell
perl -MCPAN -e shell install Zing
For more information on module installation, please visit the detailed CPAN module installation guide.