Sys::ForkQueue - Run any number of jobs in a controlled manner in parallel.
use Sys::ForkQueue; my @jobs = qw(1 2 3 4 5 6 7 8 9 10); my $Queue = Sys::ForkQueue::->new({ 'jobs' => \@jobs, 'code' => \&worker, 'logger' => Log::Tree::->new(), }); $Queue->run(); sub worker { ... }
This class implements a job controller that can run any number of jobs with configurable parllelism.
Change to this directory after fork.
If the given directory does not exist, change to /.
Set this umask after fork.
Must contain a list of job names. Each will be passed to the CODEREF in $self->code() when it's runnable.
The CODEREF. This will called for every job in the list. Ths first argument will be the job name. The second one will be $self->args() which is an hashref.
This will be passed to every invocation of $self->code().
Run this many jobs in parallel.
Redirect all output to this file.
Change to this directory after fork()ing.
Call setsid after fork().
Sleep for a brief time after fork. Set this to false if you plan to run many short lived jobs.
Run all enqueud jobs.
Imported from Errno.
Imported from POSIX.
1; # End of Sys::ForkQueue
Dominik Schulz <tex@cpan.org>
This software is copyright (c) 2012 by Dominik Schulz.
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 Sys::ForkQueue, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sys::ForkQueue
CPAN shell
perl -MCPAN -e shell install Sys::ForkQueue
For more information on module installation, please visit the detailed CPAN module installation guide.