From f3f894f685292bfc427f93df2eb9a71fda8ae669 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Fri, 14 Sep 2018 23:01:36 +1200 Subject: Add Shuffle.pm for word-wise shuffle --- Plugin/Shuffle.pm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Plugin/Shuffle.pm (limited to 'Plugin/Shuffle.pm') 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; -- cgit v1.1