
AnyEvent::CouchDB::Stream - Watch changes from a CouchDB database.

use AnyEvent::CouchDB::Stream;
my $listener = AnyEvent::CouchDB::Stream->new(
url => 'http://localhost:5984',
database => 'test',
on_change => sub {
my $change = shift;
warn "document $change->{_id} updated";
},
on_keepalive => sub {
warn "ping\n";
},
timeout => 1,
);

AnyEvent::CouchDB::Stream is an interface to the CouchDB changes database API.
URL of the CouchDB host.
Name of the CouchDB database.
Number of seconds to wait before timing out. On timeout, The on_error code ref will be called with an argument of 'timeout'.
Name of the filter to execute on this notifier.
Number to fetch changes from. Defaults to 1.
A code ref to execute when a change notification is received. It is mandatory.
A code ref to execute when keepalive is called.
A code ref to execute on error. Code ref is passed the error message.
A code ref to execute on eof
An optional hashref of headers that should be used for the HTTP request. Defaults to { 'Content-Type' = 'application/json' } >.
The interval in milliseconds between newlines sent from the server to ensure that an open connection is still being maintained

franck cuny <franck.cuny@linkfluence.net>

AnyEvent::HTTP, AnyEvent::CouchDB, AnyEvent::Twitter::Stream, http://books.couchdb.org/relax/reference/change-notifications

Copyright 2010 by Linkfluence
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.