--- lib/PXElator/CouchDB.pm 2009/08/13 00:06:48 209 +++ lib/PXElator/CouchDB.pm 2009/08/13 12:00:38 210 @@ -80,11 +80,19 @@ $rev->{$url} = $json->{_rev} = $old if defined $old; } - $json = unbless dclone $json if blessed $json; + my $data = dclone $json; + $data = unbless $data if blessed $data; - $json = JSON->new->utf8->encode( $json ) if $json; + warn dump( $data ); - $self->request(PUT => $url, $json); + $json = JSON->new->utf8->encode( $data ); + + warn $json; + + do { + eval { $self->request(PUT => $url, $json) }; + $rev->{$url} = $self->get( $url )->{_rev} if $@; + } until ! $@; } sub post { @@ -103,7 +111,7 @@ $url =~ s/\W+/-/g; my ( $package, $file, $line, $sub ) = caller(1); - ( $package, undef, $line ) = caller(0) if $package eq 'main'; +# ( $package, undef, $line ) = caller(0) if $package eq 'main'; my $time = time(); @@ -113,6 +121,7 @@ $time = int($time); # reduce granularity $audit->put( "pxelator/$time.$package.$url", $data ); + } 1;