+
+ my $json = Mojo::JSON->new->encode( $data );
+ my $client = Mojo::Client->new;
+
+ warn "# _couchdb_put $couchdb/$database/$entity.$id = $json";
+ $client->put( "$couchdb/$database/$entity.$id" => $json => sub {
+ my ($client,$tx) = @_;
+ if ($tx->error) {
+ die $tx->error;
+ }
+ my $response = $tx->res->json;
+ warn "## CouchDB response ",dump($response);
+ $couchdb_rev->{$database}->{$entity}->{$id} = $response->{rev} || die "no rev";
+ })->process;
+}
+
+sub _couchdb_get {
+ my ( $url ) = @_;
+ my $client = Mojo::Client->new;
+ my $return = $client->get( "$couchdb/$url" )->res->json;
+ warn "# _couchdb_get $url = ",dump($return);
+ return $return;
+}
+