summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2008-02-02 18:44:28 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2008-02-02 18:44:28 -0500
commit36be13d5149e8b6180a7aa7693106795414ee3e2 (patch)
tree3bd74ccbb7d202f5d1c4468b81e6f02caa14589f
parent0cbef3716f8ecfc5fd40edc8b1e0e9770b8357df (diff)
downloadgames-word-36be13d5149e8b6180a7aa7693106795414ee3e2.tar.gz
games-word-36be13d5149e8b6180a7aa7693106795414ee3e2.zip
die on remove_words if we aren't using a cache (like we already do with add_words)
-rw-r--r--lib/Games/Word/Wordlist.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Games/Word/Wordlist.pm b/lib/Games/Word/Wordlist.pm
index 59e35e0..87bb7d6 100644
--- a/lib/Games/Word/Wordlist.pm
+++ b/lib/Games/Word/Wordlist.pm
@@ -131,6 +131,9 @@ 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};
+
delete $self->{word_hash}{$_} for (@_);
$self->{word_list} = [keys %{$self->{word_hash}}];
}