I wrote Gearman::Taskset::Async, the Gearman asynchronous taskset.
for example:
use Gearman::Client;
use Gearman::Taskset::Async;
my $client = Gearman::Client->new(job_servers => ['127.0.0.1']);
my $ts = $client->new_async_task_set;
for (1..1000) {
$ts->add_task("echo" => \$_, +{on_complete => sub {
warn "COMPLETED";
warn "@_";
}, on_fail => sub {
warn "FAILED";
}});
}
$ts->run;
Gearman has asynchronous client(Gearman::Client::Async), is based on Danga::Socket.Danga::Socket imcompatible with mod_perl, because that uses class variables.
source code is here: Gearman::Taskset::Async