GearmanX::Client - Gearman client which works with GearmanX::Worker
use GearmanX::Client; my $c = new GearmanX::Client ( SERVERS => ['1.1.1.1'] ); # launch job and wait for results $result = $c->job ('jobname', { one => 'param', at => 'a time' }); # same thing $result = $c->job_sync (....); # launch job and continue $jobid = $c->job_async ('jobname', { one => 'param', at => 'a time' });
This class is simply a convenience to work comfortably alongside GearmanX::Worker. In that it mostly takes care that the single parameter (a scalar, a hash reference or a list reference) is serialized before the job is submitted to the gearman server.
The constructor expects the following fields:
SERVERS
This is a list reference holding the list of IP addresses of the involved gearman job servers.
die unless $client->status
Returns non-zero if a jobserver can be contact. Launches a fake job to test that.
$client->job ($jobname, $parameter);
Launches a job, serializes the parameter and waits for the result. That will be deserialized.
job_async
$client->job_async ($jobname, $parameter);
Launches a job, serializes the parameter and immediately returns the job id.
Robert Barta, <rho at devc.at>
<rho at devc.at>
Please report any bugs or feature requests to bug-gearmanx-worker at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=GearmanX-Worker. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-gearmanx-worker at rt.cpan.org
Copyright 2009 Robert Barta, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install GearmanX::Worker, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GearmanX::Worker
CPAN shell
perl -MCPAN -e shell install GearmanX::Worker
For more information on module installation, please visit the detailed CPAN module installation guide.