Cantella::Worker - Worker/Manager worker pool system
package TestPreforkWorkerClass; use Moose; with 'Cantella::Worker::Role::Worker'; has work_pile => ( is => 'ro', isa => 'ArrayRef', default => sub{ [1..5] }, required => 1 ); sub get_work { my $self = shift; return unless @{ $self->work_pile }; } sub work { my ($self,$work) = @_; print STDOUT "===DOING ${work}===\n"; } ############################ my $manager = Cantella::Worker::Manager::Prefork->new( logger => [ [ File => ( filename => 'myapp-error.log', newline => 1, mode => '>>', min_level => 'warning' ) ], ], workers => 3, worker_class => 'TestPreforkWorkerClass', max_worker_age => 300, close_on_call => 0, worker_args => { interval => 1, logger => [ [ Screen => (newline => 1, min_level => 'debug') ], ], }, worker_stderr_log_level => 'notice', worker_stdout_log_level => 'info', ); $manager->start;
Cantella::Worker::Manager::Prefork, Cantella::Worker::Role::Worker,
Guillermo Roditi (groditi) <groditi@cpan.org>
This software is copyright (c) 2009-2010 by Guillermo Roditi. This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install Cantella::Worker, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cantella::Worker
CPAN shell
perl -MCPAN -e shell install Cantella::Worker
For more information on module installation, please visit the detailed CPAN module installation guide.