AnyEvent-Gearman

 view release on metacpan or  search on metacpan

lib/AnyEvent/Gearman/Worker.pm  view on Meta::CPAN

NOTE: Unlike L<Gearman::Worker>, this module ignore C<$subref>'s return value.
So you should call either C<< $job->complete >> or C<< $job->fail >> at least.

This is because this module stands L<AnyEvent>'s asynchronous way, and this way more flexible in AnyEvent world.

For example:

    $worker->register_function( reverse => sub {
        my $job = shift;

        my $t; $t = AnyEvent->timer(
            after => 10,
            cb    => sub {
                undef $t;
                $job->complete('done!');
            },
        );
    });

This is simplest and meaningless codes but you can write worker process with AnyEvent way. This is asynchronous worker.



( run in 1.141 second using v1.01-cache-2.11-cpan-49f99fa48dc )