summaryrefslogtreecommitdiff
path: root/lib/Net/Riak/MapReduce.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Net/Riak/MapReduce.pm')
-rw-r--r--lib/Net/Riak/MapReduce.pm23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/Net/Riak/MapReduce.pm b/lib/Net/Riak/MapReduce.pm
index 03a3dd3..14e4007 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 {
+ $self->add_object($arg);
+ } else {
$self->add_bucket($arg);
}
}
@@ -246,12 +253,22 @@ The MapReduce object allows you to build up and run a map/reduce operations on R
=head2 add
-arguments: bucketname or object
+arguments: bucketname or arrays or L<Net::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") );
+
=head2 add_object
=head2 add_bucket_key_data