aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-09-14 23:01:36 +1200
committerDavid Phillips <david@sighup.nz>2018-09-14 23:01:36 +1200
commitf3f894f685292bfc427f93df2eb9a71fda8ae669 (patch)
tree71cbbaca0b9fd2685ea53bbdb2eda17110c73356
parent14d03ea7e78ef45f0842a50f3734ea146a90682b (diff)
downloadidalius-f3f894f685292bfc427f93df2eb9a71fda8ae669.tar.xz
Add Shuffle.pm for word-wise shuffle
-rw-r--r--Plugin/Shuffle.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/Plugin/Shuffle.pm b/Plugin/Shuffle.pm
new file mode 100644
index 0000000..dc39898
--- /dev/null
+++ b/Plugin/Shuffle.pm
@@ -0,0 +1,26 @@
+package Plugin::Shuffle;
+
+use strict;
+use warnings;
+
+use List::Util;
+
+my %config;
+
+sub configure {
+ my $self = shift;
+ my $cmdref = shift;
+ my $cref = shift;
+ %config = %$cref;
+
+ $cmdref->("shuffle", sub { $self->shuffle(@_); } );
+
+ return $self;
+}
+
+sub shuffle {
+ my ($self, $irc, $logger, $who, $where, $rest, @arguments) = @_;
+
+ return join " ", List::Util::shuffle(@arguments);
+}
+1;