Kevin L. Esteb > XAS-0.04 > XAS::Lib::Gearman::Worker

Download:
XAS-0.04.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source   Latest Release: XAS-0.05

NAME ^

XAS::Lib::Gearman::Worker - An interface to the Gearman job queue.

SYNOPSIS ^

 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());

DESCRIPTION ^

This is a wrapper module around Gearman::XS::Worker.

METHODS ^

new

This method intializes the module and connects to the gearman server. It takes two parameters:

-server

The server where gearman resides, defaults to 'localhost'.

-port

The IP port that gearman is listening on, defaults to 4730.

work

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.

add_function

Notify gearman that we can handle this function. It takes three parameters:

-queue

The queue that this procedure will listen on.

-function

The callback that will do the work.

-options

Optional options to be passed to gearman.

SEE ALSO ^

 Gearman::XS
 Gearman::XS::Client
 Gearman::XS::Worker

XAS

AUTHOR ^

Kevin L. Esteb, <kevin@kesteb.us>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: