diff options
| author | Robin Edwards <robin.ge@gmail.com> | 2013-03-20 12:15:29 +0000 |
|---|---|---|
| committer | Robin Edwards <robin.ge@gmail.com> | 2013-03-20 12:22:48 +0000 |
| commit | 6910b7be19c747c5b8044a58c1877272530957db (patch) | |
| tree | 810c1a9d019b171004b238497d6fe96f928a5257 /lib/Net/Riak/Role | |
| parent | Bump version for release (diff) | |
| download | net-riak-6910b7be19c747c5b8044a58c1877272530957db.tar.gz | |
Clean up ws
Diffstat (limited to 'lib/Net/Riak/Role')
| -rw-r--r-- | lib/Net/Riak/Role/PBC.pm | 2 | ||||
| -rw-r--r-- | lib/Net/Riak/Role/PBC/Bucket.pm | 9 | ||||
| -rw-r--r-- | lib/Net/Riak/Role/PBC/Link.pm | 12 | ||||
| -rw-r--r-- | lib/Net/Riak/Role/PBC/MapReduce.pm | 5 | ||||
| -rw-r--r-- | lib/Net/Riak/Role/PBC/Object.pm | 10 |
5 files changed, 15 insertions, 23 deletions
diff --git a/lib/Net/Riak/Role/PBC.pm b/lib/Net/Riak/Role/PBC.pm index 775976e..7e6aee3 100644 --- a/lib/Net/Riak/Role/PBC.pm +++ b/lib/Net/Riak/Role/PBC.pm @@ -82,4 +82,4 @@ sub server_info { sub stats { die "->stats is only avaliable through the REST interface" } -1; +1; diff --git a/lib/Net/Riak/Role/PBC/Bucket.pm b/lib/Net/Riak/Role/PBC/Bucket.pm index aa7d7fa..6cd4240 100644 --- a/lib/Net/Riak/Role/PBC/Bucket.pm +++ b/lib/Net/Riak/Role/PBC/Bucket.pm @@ -1,7 +1,5 @@ package Net::Riak::Role::PBC::Bucket; - use Moose::Role; -use Data::Dumper; sub get_properties { my ( $self, $name, $params ) = @_; @@ -29,7 +27,7 @@ sub get_keys { if ( defined $_[0]->keys ) { if ($params->{cb}) { $params->{cb}->($_) for @{ $_[0]->keys }; - } + } else { push @$keys, @{ $_[0]->keys }; } @@ -37,10 +35,7 @@ sub get_keys { } ); - return $params->{cb} ? undef : $keys; + return $params->{cb} ? undef : $keys; } - - 1; - diff --git a/lib/Net/Riak/Role/PBC/Link.pm b/lib/Net/Riak/Role/PBC/Link.pm index 5e6a336..7cba54a 100644 --- a/lib/Net/Riak/Role/PBC/Link.pm +++ b/lib/Net/Riak/Role/PBC/Link.pm @@ -23,12 +23,12 @@ sub _links_for_message { my ($self, $object) = @_; return [ - map { { - tag => $_->tag, - key => $_->key, - bucket => $_->bucket->name - } - } $object->all_links + map { { + tag => $_->tag, + key => $_->key, + bucket => $_->bucket->name + } + } $object->all_links ] } diff --git a/lib/Net/Riak/Role/PBC/MapReduce.pm b/lib/Net/Riak/Role/PBC/MapReduce.pm index afeabe8..00e7de1 100644 --- a/lib/Net/Riak/Role/PBC/MapReduce.pm +++ b/lib/Net/Riak/Role/PBC/MapReduce.pm @@ -2,7 +2,6 @@ package Net::Riak::Role::PBC::MapReduce; use Moose::Role; use JSON; use List::Util 'sum'; -use Data::Dump 'pp'; sub execute_job { my ($self, $job, $timeout, $returned_phases) = @_; @@ -16,8 +15,8 @@ sub execute_job { my $resp = $self->send_message( MapRedReq => { request => $job_request, content_type => 'application/json' - }, sub { push @$results, $self->decode_phase(shift) }) - or + }, sub { push @$results, $self->decode_phase(shift) }) + or die "MapReduce query failed!"; diff --git a/lib/Net/Riak/Role/PBC/Object.pm b/lib/Net/Riak/Role/PBC/Object.pm index 280956c..0f960d2 100644 --- a/lib/Net/Riak/Role/PBC/Object.pm +++ b/lib/Net/Riak/Role/PBC/Object.pm @@ -1,8 +1,6 @@ package Net::Riak::Role::PBC::Object; - use JSON; use Moose::Role; -use Data::Dumper; use List::Util 'first'; sub store_object { @@ -10,7 +8,7 @@ sub store_object { die "Storing object without a key is not supported in the PBC interface" unless $object->key; - my $value = (ref $object->data && $object->content_type eq 'application/json') + my $value = (ref $object->data && $object->content_type eq 'application/json') ? JSON::encode_json($object->data) : $object->data; my $content = { @@ -94,7 +92,7 @@ sub populate_object { $self->_populate_metas($object, $content->usermeta); } - my $data = ($object->content_type eq 'application/json') + my $data = ($object->content_type eq 'application/json') ? JSON::decode_json($content->value) : $content->value; $object->exists(1); @@ -117,7 +115,7 @@ sub retrieve_sibling { # hack for loading 1 sibling if ($params->{vtag}) { - $resp->{content} = [ + $resp->{content} = [ first { $_->vtag eq $params->{vtag} } @{$resp->content} @@ -133,7 +131,7 @@ sub retrieve_sibling { $sibling->_jsonize($object->_jsonize); $self->populate_object($sibling, $resp); - + $sibling; } |
