From 33b51e347e018511751fdba5d10f8171acdf60d7 Mon Sep 17 00:00:00 2001 From: jluehrs2 Date: Sat, 2 Feb 2008 20:10:40 -0500 Subject: change the style of the documentation a bit to be more readable --- lib/Games/Word/Wordlist.pm | 60 ++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 37 deletions(-) diff --git a/lib/Games/Word/Wordlist.pm b/lib/Games/Word/Wordlist.pm index d242757..7dd5d28 100644 --- a/lib/Games/Word/Wordlist.pm +++ b/lib/Games/Word/Wordlist.pm @@ -36,7 +36,9 @@ randomly or by regex. =head1 CONSTRUCTOR -=head2 new() +=over 4 + +=item new PARAMHASH The constructor initializes the word list with words, either from a file or from an arrayref, given as the first argument. The remaining arguments are a @@ -55,6 +57,8 @@ program. =back +=back + =cut sub new { @@ -93,7 +97,9 @@ sub new { =head1 METHODS -=head2 add_words +=over 4 + +=item add_words Add words to the word list. Only works if the word list has been cached. @@ -120,11 +126,9 @@ sub add_words { return; } -=head2 remove_words - -Removes words from the word list. Only works if the word list is cached. +=item remove_words LIST -Takes a list of words to remove (ignoring words that aren't in the word list). +Removes words in LIST from the word list. Only works if the word list is cached. =cut @@ -139,7 +143,7 @@ sub remove_words { return; } -=head2 words +=item words Returns the number of words in the word list. @@ -191,12 +195,9 @@ sub _random_word_nocache { return $word; } -=head2 random_word +=item random_word [LENGTH] -Returns a random word from the word list, optionally of a specified length. - -Takes a single optional integer argument, which will make it only consider -words of that length in its search. +Returns a random word from the word list, optionally of length LENGTH. =cut @@ -227,13 +228,9 @@ sub _is_word_nocache { return 0; } -=head2 is_word - -Tests whether a word is in the word list. +=item is_word STRING -Takes a single argument, the word to be tested. - -Returns true if the word is found in the word list, false otherwise. +Returns true if STRING is found in the word list, and false otherwise. =cut @@ -273,14 +270,9 @@ sub _each_word { return $self->_each_word_nocache(@_); } -=head2 anagrams - -Finds all anagrams of a given string. - -Takes an argument of a string. +=item anagrams STRING -Returns a list of all permutations of that string that are found in the word -list. +Returns a list of all permutations of STRING that are found in the word list. =cut @@ -291,13 +283,9 @@ sub anagrams { return uniq grep { $self->is_word($_) } all_permutations($word); } -=head2 words_like - -Searches through the word list by regex. - -Takes an argument of a regex. +=item words_like REGEX -Returns a list containing all words in the word list matching that regex. +Returns a list containing all words in the word list which match REGEX. =cut @@ -311,14 +299,10 @@ sub words_like { return @words; } -=head2 subwords_of - -Searches for words which can be made using the letters of a given string. - -Takes an argument of a string. +=item subwords_of STRING Returns a list of words from the word list which can be made using the letters -in that string. +in STRING. =cut @@ -333,6 +317,8 @@ sub subwords_of { return @words; } +=back + =head1 SEE ALSO L -- cgit v1.2.3-54-g00ecf