POE::Wheel::Spawner - A simple subprocess spawner
POE::Wheel::Spawner starts on run only one subprocess for the workload. Until number of subprocesses does not exceed pool_size each subprocess can spawn another one.
Version v0.03.2
use POE::Wheel::Spawner; my $foo = POE::Wheel::Spawner->new( pool_size => 2, stop_if_done => 1, workload => sub { _workload() } ); $foo->run(); sub _workload { # request for a new sibling $foo->spawn($$); # ... }
Arguments:
pool_size
the number of maximal parallel executed workload
workload
stop_if_done
stop after all pool_size pid's are exited.
run endless if !stop_if_done
CODE reference to be executed
optional %arg arguments for POE::Session:
%arg
debug
default 0
trace
create a POE::Session
run POE::Kernel
request to spawn
Alexei Pastuchov <palik at cpan.org>.
https://github.com/p-alik/POE-Wheel-Spawner.git
Copyright 2014-2016 by Alexei Pastuchov <palik at cpan.org>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install POE::Wheel::Spawner, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Wheel::Spawner
CPAN shell
perl -MCPAN -e shell install POE::Wheel::Spawner
For more information on module installation, please visit the detailed CPAN module installation guide.