summaryrefslogtreecommitdiffstats
path: root/lib/Games/Word/Wordlist.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Games/Word/Wordlist.pm')
-rw-r--r--lib/Games/Word/Wordlist.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Games/Word/Wordlist.pm b/lib/Games/Word/Wordlist.pm
index 399aff4..f7f9716 100644
--- a/lib/Games/Word/Wordlist.pm
+++ b/lib/Games/Word/Wordlist.pm
@@ -2,6 +2,8 @@
package Games::Word::Wordlist;
use strict;
use warnings;
+use Games::Word qw/all_permutations/;
+use List::MoreUtils qw/uniq/;
sub new {
my $class = shift;
@@ -105,6 +107,13 @@ sub _each_word {
return $self->_each_word_nocache(@_);
}
+sub anagrams {
+ my $self = shift;
+ my $word = shift;
+
+ return uniq grep { $self->is_word($_) } all_permutations($word);
+}
+
=head1 NAME
Games::Word::Wordlist - ???