The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

POE::Component::Client::CouchDB - Asynchronous CouchDB server interaction

VERSION

Version 0.05

SYNOPSIS

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();

ATTRIBUTES

rest

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))

host

The hostname of the CouchDB server. Defaults to localhost.

port

The port of the CouchDB server. Defaults to 5984.

METHODS

Note that all of these methods take a callback keyword argument (CODE or [session, state]) as their last argument except where otherwise noted.

call method, path, ...

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.

all_dbs
create_db name
delete_db name
db_info name

These all do what you would expect according to the CouchDB documentation. See http://wiki.apache.org/couchdb/HttpDatabaseApi.

database name
db name

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!

shutdown

Equivalent to $obj->rest->shutdown();

AUTHOR

Paul Driver, <frodwith at cpan.org>

BUGS

Probably.

COPYRIGHT & LICENSE

Copyright 2008 Paul Driver

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.