AnyEvent-CouchDB

 view release on metacpan or  search on metacpan

eg/async-via-cb  view on Meta::CPAN


for (1..8) {
  # By giving the condvar our own callback, we can use AnyEvent::CouchDB in 
  # a truly asynchronous way.  The client will not block when called like this.
  $db->all_docs->cb(sub {
    my $data = $_[0]->recv;
    print pp($data), "\n";
  });
}

my $w  = AnyEvent->timer(after => 2, cb => sub { exit });
my $cv = AnyEvent->condvar;
$cv->recv;

lib/AnyEvent/CouchDB/Stream.pm  view on Meta::CPAN

        $headers->{Authorization} = 'Basic ' . encode_base64($userinfo, '');
    }

    my $self = bless {}, $class;

    {
        Scalar::Util::weaken( my $self = $self );
        my $set_timeout = $timeout
            ? sub {
            $self->{timeout}
                = AE::timer( $timeout, 0, sub { $on_error->('timeout') } );
            }
            : sub { };

        $set_timeout->();

        $self->{connection_guard} = http_get(
            $uri,
            headers   => $headers,
            on_header => sub {
                my ($headers) = @_;



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