diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2008-02-02 19:12:48 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2008-02-02 19:12:48 -0500 |
commit | b43f516ca28514811819219fa0295bc4c9fafdc2 (patch) | |
tree | 982f25fbb3381e1a36af65b2f5a25af391b3de6d | |
parent | 809cd5446a5cccac0f29c1d269e3f28640f7176f (diff) | |
download | games-word-b43f516ca28514811819219fa0295bc4c9fafdc2.tar.gz games-word-b43f516ca28514811819219fa0295bc4c9fafdc2.zip |
a few minor cleanups
-rw-r--r-- | lib/Games/Word/Wordlist.pm | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Games/Word/Wordlist.pm b/lib/Games/Word/Wordlist.pm index ab1b752..d242757 100644 --- a/lib/Games/Word/Wordlist.pm +++ b/lib/Games/Word/Wordlist.pm @@ -106,8 +106,7 @@ sub add_words { my $self = shift; my $word_list = shift; - die "Can't add words to a non-cached word list" - unless $self->{cache}; + die "Can't add words to a non-cached word list" unless $self->{cache}; if (ref($word_list) eq 'ARRAY') { $self->{word_hash}{$_} = 1 for @$word_list; @@ -132,8 +131,7 @@ Takes a list of words to remove (ignoring words that aren't in the word list). sub remove_words { my $self = shift; - die "Can't remove words from a non-cached word list" - unless $self->{cache}; + die "Can't remove words from a non-cached word list" unless $self->{cache}; delete $self->{word_hash}{$_} for (@_); $self->{word_list} = [keys %{$self->{word_hash}}]; @@ -153,6 +151,7 @@ sub words { return @{$self->{word_list}} if $self->{cache}; open my $fh, '<', $self->{file} or die "Opening $self->{file} failed"; for (<$fh>) {} + return $.; } |