ElasticSearch::AnyEvent - async Perl client

Hi all

For the Perl users out there:

I've just pushed ElasticSearch::AnyEvent - this brings async requests to
the Perl ElasticSearch client. It is still lacking proper documentation
and any tests, which will soon follow.

It is available on the anyevent branch on github:

http://github.com/clintongormley/ElasticSearch.pm/tree/anyevent

This is my first foray into async programming in Perl, so I'd appreciate
feedback on the API and code.

Briefly, it can be used as follows:

use ElasticSearch::AnyEvent();
my $es = ElasticSearch::AnyEvent->new(servers=>'127.0.0.1:9200');

Blocking

 my $cv = $es->current_server;
 print $cv->recv;

 # or

 print $es->current_server->recv

Callback

 my $cv = $es->current_server;
 $es->cb(sub {
     my $result = shift || die $@;
     ....
 });

Context

 my $cv = $es->current_server;
 undef $cv;                      # cancels

 $es->refresh_servers;           # fire-and-forget
 start_event_loop();

 {
    my $cv1 = $es->foo;
    my $cv2 = $es->foo;
    $cv2->cb(...);
 }
 # $cv1 is cancelled
 # $cv2 is backgrounded / fire-and-forget

Multitask:

 $es->multi_task(
     action      => 'index',
     pull_queue  => sub {
         # returns a list of HASHes to be passed to

$es->$action(...)
# can return (eg) 1000 at a time
},
on_success => sub { # optional
my ($args,$result) = @;
...
},
on_error => sub { # optional
my ($error,$args,$queue) = @
;
...
},
)->recv || die "Error";

thanks

Clint