AnyEvent-CouchDB
view release on metacpan or search on metacpan
lib/AnyEvent/CouchDB.pm view on Meta::CPAN
still responsive.
=back
If you're not using Coro, and you don't want your whole program to block,
what you should do is call C<cb> on the condvar, and give it a coderef to
execute when the results come back. The coderef will be given a condvar
as a parameter, and it can call C<recv> on it to get the data. The final
example in the SYNOPSIS gives a brief example of this.
Also note that C<recv> will throw an exception if the request fails, so be
prepared to catch exceptions where appropriate.
Please read the L<AnyEvent> documentation for more information on the proper
use of condvars.
=head2 The \%options Parameter
Many data retrieval methods will take an optional C<\%options> hashref.
Most of these options get turned into CGI query parameters. The standard
CouchDB parameters are as follows:
lib/AnyEvent/CouchDB/Database.pm view on Meta::CPAN
GET => $self->uri . '_all_docs_by_seq' . $query->($options),
headers => $self->_build_headers($options),
$cb
);
$cv;
}
sub open_doc {
my ( $self, $doc_id, $options ) = @_;
if ( not defined $doc_id ) {
AnyEvent::CouchDB::Exception::UndefinedDocument->throw(
"An undefined id was passed to open_doc()."
);
}
my ( $cv, $cb ) = cvcb( $options, undef, $self->json_encoder );
my $id = uri_escape_utf8($doc_id);
if ( $id =~ qr{^_design%2F} ) {
$id =~ s{%2F}{/}g;
}
http_request(
GET => $self->uri . $id . $query->($options),
lib/AnyEvent/CouchDB/Exceptions.pm view on Meta::CPAN
=head1 API
This module provides the following methods in addition to the methods provided
by L<Exception::Class::Base>.
=head2 Additional Accessors
=head3 $e->headers
This method will return the HTTP response headers if they were available at
the time the exception was thrown.
=head3 $e->body
This method will return the HTTP response body if it was available at
the time the exception was thrown.
=cut
( run in 0.395 second using v1.01-cache-2.11-cpan-496ff517765 )