POE::Component::Client::CouchDB - Asynchronous CouchDB server interaction
Version 0.05
This class makes use of POE::Component::Client::REST::JSON to provide an asynchronous interface to the CouchDB REST API. All methods use call to make the request, and follow its calling convention.
use POE qw(Component::Client::CouchDB); my $alias = 'Huzzah!'; POE::Session->create(inline_states => { _start => sub { $poe_kernel->alias_set($alias); my $couch = POE::Component::Client::CouchDB->new; $couch->create_db('foobar', callback => [$alias, 'db_created']); }, db_created => sub { my ($data, $response) = @_[ARG0..ARG1]; use YAML; print Dump($data); $poe_kernel->alias_remove($alias); }, }); $poe_kernel->run();
You can optionally supply a configured POE::Component::Client::REST::JSON object to be used, but by default one will be created (you can also get this one to pass to another DB object... ->new(rest => $old->rest))
->new(rest => $old->rest)
The hostname of the CouchDB server. Defaults to localhost.
The port of the CouchDB server. Defaults to 5984.
Note that all of these methods take a callback keyword argument (CODE or [session, state]) as their last argument except where otherwise noted.
This is POE::Component::Client::REST::JSON's call with the url part partially filled in - use a path instead (such as "_all_dbs"). You shouldn't need to use this directly, so don't.
These all do what you would expect according to the CouchDB documentation. See http://wiki.apache.org/couchdb/HttpDatabaseApi.
Returns a new POE::Component::Client::CouchDB::Database representing the database with the specified name. This method does not follow the REST calling conventions, cause it's not a REST call!
Equivalent to $obj->rest->shutdown();
Paul Driver, <frodwith at cpan.org>
<frodwith at cpan.org>
Probably.
Copyright 2008 Paul Driver
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install POE::Component::Client::CouchDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Component::Client::CouchDB
CPAN shell
perl -MCPAN -e shell install POE::Component::Client::CouchDB
For more information on module installation, please visit the detailed CPAN module installation guide.