XAS::Lib::Gearman::Worker - An interface to the Gearman job queue.
use XAS::Lib::Gearman::Worker; sub reverse { my $job = shift; .... .... } my $worker = XAS::Lib::Gearman::Worker->new( -server => 'localhost', -port => '4730' ); $worker->add_function( -queue => 'reverse', -function => \&reverse, -options => {} ); while ($worker->work());
This is a wrapper module around Gearman::XS::Worker.
This method intializes the module and connects to the gearman server. It takes two parameters:
The server where gearman resides, defaults to 'localhost'.
The IP port that gearman is listening on, defaults to 4730.
This method is used to wait for work from gearman. It handles some common error conditions. It will throw an exception when something unexpected happens.
Notify gearman that we can handle this function. It takes three parameters:
The queue that this procedure will listen on.
The callback that will do the work.
Optional options to be passed to gearman.
Gearman::XS Gearman::XS::Client Gearman::XS::Worker
XAS
Kevin L. Esteb, <kevin@kesteb.us>
Copyright (C) 2012 by Kevin L. Esteb
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install XAS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XAS
CPAN shell
perl -MCPAN -e shell install XAS
For more information on module installation, please visit the detailed CPAN module installation guide.