CouchDB::Client - Simple, correct client for CouchDB
use CouchDB::Client; my $c = CouchDB::Client->new(uri => 'https://dbserver:5984/'); $c->testConnection or die "The server cannot be reached"; print "Running version " . $c->serverInfo->{version} . "\n"; my $db = $c->newDB('my-stuff')->create; # listing databases $c->listDBs; $c->listDBNames;
This module is a client for the CouchDB database.
Constructor. Takes a hash or hashref of options: uri which specifies the server's URI; scheme, host, port which are used if uri isn't provided and default to 'http', 'localhost', and '5984' respectively; json which defaults to a JSON::Any object with utf8 and allow_blessed turned on but can be replaced with anything with the same interface; and ua which is a LWP::UserAgent object and can also be replaced.
uri
scheme
host
port
json
ua
Returns true if a connection can be made to the server, false otherwise.
Returns a hashref of the server metadata, typically something that looks like { couchdb => "Welcome", version => "0.8.0-incubating"}. It throws an exception if it can't connect.
{ couchdb => "Welcome", version => "0.8.0-incubating"}
Returns a new CouchDB::Client::DB object for a database of that name. Note that the DB does not need to exist yet, and will not be created if it doesn't.
CouchDB::Client::DB
Returns an arrayref of all the database names that the server knows of. Throws an exception if it cannot connect.
Same as above but returns an arrayref of CouchDB::Client::DB objects instead.
Returns true if a database of that name exists, false otherwise.
You will use these at your own risk
$METHOD is the HTTP method to use; $PATH the part of the path that follows scheme://host:port/; and $CONTENT a Perl data structure. The latter, if present, is encoded to JSON and the request is made using the given method and path. The return value is a hash containing a boolean indicating success, a status being the HTTP response code, a descriptive msg, and a json field containing the response JSON.
scheme://host:port/
success
status
msg
Gets a path and returns the complete URI.
Robin Berjon, <robin @t berjon d.t com> Maverick Edwards, <maverick @t smurfbane d.t org> (current maintainer)
Please report any bugs or feature requests to bug-couchdb-client at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CouchDB-Client.
Copyright 2008 Robin Berjon, all rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install CouchDB::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CouchDB::Client
CPAN shell
perl -MCPAN -e shell install CouchDB::Client
For more information on module installation, please visit the detailed CPAN module installation guide.