Alan Kasindorf > Gearman-1.11 > Gearman::Task

Download:
Gearman-1.11.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  17
Open  2
View/Report Bugs
Source  

NAME ^

Gearman::Task - a task in Gearman, from the point of view of a client

SYNOPSIS ^

    my $task = Gearman::Task->new("add", "1+2", {
            .....

    };

    $taskset->add_task($task);
    $client->do_task($task);
    $client->dispatch_background($task);

DESCRIPTION ^

Gearman::Task is a Gearman::Client's representation of a task to be done.

USAGE ^

Gearman::Task->new($func, $arg, \%options)

Creates a new Gearman::Task object, and returns the object.

$func is the function name to be run. (that you have a worker registered to process)

$arg is an opaque scalar or scalarref representing the argument(s) to pass to the distributed function. If you want to pass multiple arguments, you must encode them somehow into this one. That's up to you and your worker.

%options can contain:

$task->is_finished

Returns bool: whether or not task is totally done (on_failure or on_complete callback has been called)

syntax highlighting: