AnyEvent::ProcessPool::Pipeline - A simplified, straightforward way to parallelize tasks
version 0.02
use AnyEvent::ProcessPool::Pipeline; pipeline workers => 4, in { get_next_task(); }, out { process_result(shift->recv); };
Launches an AnyEvent::ProcessPool and immediately starts processing tasks it receives when executing the code specified by in. As results arrive (and not necessarily in the order in which they were queued), they are delivered as condition variables (ready ones, guaranteed not to block) via the code supplied by out. The pipeline will continue to run until in returns undef, after which it will continue to run until all pending results have been delivered. pipeline returns the total number of tasks processed.
in
out
undef
pipeline
Aside from in and out, all other arguments are passed unchanged to AnyEvent::ProcessPool's constructor.
Jeff Ober <sysread@fastmail.fm>
This software is copyright (c) 2017 by Jeff Ober.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install AnyEvent::ProcessPool, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AnyEvent::ProcessPool
CPAN shell
perl -MCPAN -e shell install AnyEvent::ProcessPool
For more information on module installation, please visit the detailed CPAN module installation guide.