diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-02-02 20:31:13 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-02-02 20:31:13 -0500 |
commit | 275f0479a6c57f9d58642241016121958b96e6a1 (patch) | |
tree | 9c71ba1d299785917f40e95618dffc782a674def | |
parent | 43be917b6b4b33d17efacbbb1e53708e6413c176 (diff) | |
download | games-word-275f0479a6c57f9d58642241016121958b96e6a1.tar.gz games-word-275f0479a6c57f9d58642241016121958b96e6a1.zip |
make each_word public
-rw-r--r-- | lib/Games/Word/Wordlist.pm | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/Games/Word/Wordlist.pm b/lib/Games/Word/Wordlist.pm index 5471d3e..096166a 100644 --- a/lib/Games/Word/Wordlist.pm +++ b/lib/Games/Word/Wordlist.pm @@ -263,7 +263,14 @@ sub _each_word_nocache { return; } -sub _each_word { +=item each_word CODE + +Call CODE for each word in the word list. The current word will be passed into +CODE as its only argument. + +=cut + +sub each_word { my $self = shift; return $self->_each_word_cache(@_) if $self->{cache}; @@ -281,7 +288,7 @@ sub anagrams { my $word = shift; my @words = (); - $self->_each_word(sub { push @words, $_[0] + $self->each_word(sub { push @words, $_[0] if is_permutation($word, $_[0]) }); return @words; @@ -298,7 +305,7 @@ sub words_like { my $re = shift; my @words = (); - $self->_each_word(sub { push @words, $_[0] if $_[0] =~ $re }); + $self->each_word(sub { push @words, $_[0] if $_[0] =~ $re }); return @words; } @@ -315,7 +322,7 @@ sub subwords_of { my $string = shift; my @words = (); - $self->_each_word(sub { push @words, $_[0] + $self->each_word(sub { push @words, $_[0] if is_subpermutation($_[0], $string)}); return @words; |