Net::CouchDb::Document - Represent a CouchDb document
Provides an object oriented interface to the CouchDb REST/JSON API.
Creates a new instance of a document in memory, all parameters are optional.
If an ID is not provided one will be generated automatically by CoudhDb when the document is created.
A hash reference is expected for the fields.
If the database is provided then it will be used for the ->create and ->update methods.
create
update
Note: The new method merely creates an instance of the object; it does not touch the database.
new
Getter/setter for the ID.
Getter/setter for the revision.
Return a URI to this document. Requires document to have been created.
Create this document (using the database specified in new).
If an ID has not been previously supplied CouchDb will create one and the object will be updated to reflect this.
Update this document (using the database specified in new).
List, add or retrieve attachments.
With no parameters returns a list of attached files.
With a name returns a Net::CouchDb::Attach object.
With file specified as well passes the file parameter to the add method of Net::CouchDb::Attach.
add
This object provides an autoloaded method for any parameter that is set, therefore any field can be set like so:
$doc->foo = "bar";
Because id, rev, uri, attach, create and update are taken by the above methods you should use syntax like:
id
rev
uri
attach
$doc->{create} = 1;
If you want to give parameters those names.
David Leadbeater, <dgl at dgl dot cx>
<dgl at dgl dot cx>
Copyright 2007 David Leadbeater, 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 Net::CouchDb, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::CouchDb
CPAN shell
perl -MCPAN -e shell install Net::CouchDb
For more information on module installation, please visit the detailed CPAN module installation guide.