summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2008-02-02 00:04:40 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2008-02-02 00:04:40 -0500
commit69f8d7813a20f41568a6eec0503f04dce2e81613 (patch)
treeff68877fc13d7cd77b9b0cbea691002e2da287e4
parentac7fd1b400c0a4d11047f80fd151c5df84c9d1a9 (diff)
downloadgames-word-69f8d7813a20f41568a6eec0503f04dce2e81613.tar.gz
games-word-69f8d7813a20f41568a6eec0503f04dce2e81613.zip
make $wl->words work properly when the wordlist isn't cached
-rw-r--r--lib/Games/Word/Wordlist.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Games/Word/Wordlist.pm b/lib/Games/Word/Wordlist.pm
index 702f5a1..81f8a5b 100644
--- a/lib/Games/Word/Wordlist.pm
+++ b/lib/Games/Word/Wordlist.pm
@@ -67,8 +67,10 @@ sub remove_words {
sub words {
my $self = shift;
- return unless $self->{cache};
- return @{$self->{word_list}};
+ return @{$self->{word_list}} if $self->{cache};
+ open my $fh, '<', $self->{file};
+ for (<$fh>) {}
+ return $.;
}
sub _random_word_cache {