NAME

DB::CouchDB::Iter - a result iterator object for CouchDB views

DESCRIPTION

Gives you some convenience functions for dealing with CouchDB view results

SYNOPSIS

my $iter = $db->view($viewname);

if ($rs->err) {
    die $rs->errstr;
}
while ( my $doc = $iter->next() ) {
    my $doc_id = $doc->{_id};
    my %result = %$doc;
}
while ( my $doc = $iter->next_for_key($key) ) {
    my $doc_id = $doc->{_id};
    my %result = %$doc;
}

Methods

err

Returns the error from couchdb if there was an error.

errstr

Returns the error string from couchdb if there was an error.

count

Returns the record count returned for the view.

offset

Returns the offset of the records returned.

data

Returns all the rows returned by the view.

next

Return the next row in the result set or undef if no more rows are left.

next_key

Returns the next key in the result set from a view. Does not return the results for that key though.

next_for_key

while ( my $result = $db->next_for_key($key) ) {
    ... # do something with the result
 }

Returns the next result for a key in the results for a view