CPS::Governor::IOAsync - use IO::Async with CPS
CPS::Governor::IOAsync
use CPS qw( gkforeach ); use CPS::Governor::IOAsync; use IO::Async::Loop; my $loop = IO::Async::Loop->new; my $gov = CPS::Governor::IOAsync->new( loop => $loop ); gkforeach( $gov, [ 1 .. 10 ], sub { my ( $item, $knext ) = @_; $loop->do_something( on_done => $knext ); }, sub { $loop->loop_stop }, ); $loop->loop_forever;
This CPS::Governor allows functions using it to defer their re-execution by using the IO::Async::Loop later method, meaning it will interleave with other IO operations performed by IO::Async.
later
IO::Async
Returns a new instance of a CPS::Governor::IOAsync object. Requires the following argument:
Reference to the IO::Async::Loop object.
IO::Async::Loop
Additionally may take any other arguments defined by the CPS::Governor::Deferred class.
Paul Evans <leonerd@leonerd.org.uk>
To install CPS::Governor::IOAsync, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CPS::Governor::IOAsync
CPAN shell
perl -MCPAN -e shell install CPS::Governor::IOAsync
For more information on module installation, please visit the detailed CPAN module installation guide.