summaryrefslogtreecommitdiff
path: root/lib/Net
diff options
context:
space:
mode:
authorgmaurice <gmaurice@gm.livebox.home>2010-10-05 15:34:49 +0200
committerfranck cuny <franck@lumberjaph.net>2010-11-02 15:27:11 +0100
commita3e5554ff13b923b67768980e69bd43ae34914a9 (patch)
tree5f1cf1c51ab42cff96d7973a087fd277da4735ce /lib/Net
parentpod (diff)
downloadnet-riak-a3e5554ff13b923b67768980e69bd43ae34914a9.tar.gz
add support of array arguments in Net::Riak::MapReduce->add()
Diffstat (limited to 'lib/Net')
-rw-r--r--lib/Net/Riak/MapReduce.pm21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/Net/Riak/MapReduce.pm b/lib/Net/Riak/MapReduce.pm
index 499335a..70ed214 100644
--- a/lib/Net/Riak/MapReduce.pm
+++ b/lib/Net/Riak/MapReduce.pm
@@ -48,10 +48,17 @@ sub add {
my $self = shift;
my $arg = shift;
+ if (ref $arg eq 'ARRAY') {
+ do{
+ $self->add_input($arg);
+ }while(my $arg = shift @_);
+ return $self;
+ }
+
if (!scalar @_) {
if (blessed($arg)) {
$self->add_object($arg);
- } else {
+ } else {
$self->add_bucket($arg);
}
}
@@ -225,12 +232,22 @@ The RiakMapReduce object allows you to build up and run a map/reduce operation o
=item add
-arguments: bucketname
+arguments: bucketname or arrays or Riak::Object
return: a Net::Riak::MapReduce object
Add inputs to a map/reduce operation. This method takes three different forms, depending on the provided inputs. You can specify either a RiakObject, a string bucket name, or a bucket, key, and additional arg.
+Create a MapReduce job
+
+ my $mapred = $riak->add( ["alice","p1"],["alice","p2"],["alice","p5"] );
+
+Add your inputs to a MapReduce job
+
+ $mapred->add( ["alice","p1"],["alice","p2"] );
+ $mapred->add( "alice", "p5" );
+ $mapred->add( $riak->bucket("alice")->get("p6") );
+
=item add_object
=item add_bucket_key_data