NAME

GearmanX::Client - Gearman client which works with GearmanX::Worker

SYNOPSIS

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' });

DESCRIPTION

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.

INTERFACE

Constructor

The constructor expects the following fields:

SERVERS

This is a list reference holding the list of IP addresses of the involved gearman job servers.

Methods

status

die unless $client->status

Returns non-zero if a jobserver can be contact. Launches a fake job to test that.

job, job_sync

$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.

AUTHOR

Robert Barta, <rho at devc.at>

BUGS

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.

COPYRIGHT & LICENSE

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.