summaryrefslogtreecommitdiffstats
path: root/lib/Bot
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-06-01 23:15:03 -0500
committerJesse Luehrs <doy@tozt.net>2009-06-01 23:21:28 -0500
commitabe748bcfbb9bff0c358d0e2b6dd5aee6c4a29a9 (patch)
tree8e1f843e6c7366d585611d6c4dd780eb2ba22bc8 /lib/Bot
parentdd43ac4f9fcd4b06824e070ac822e1928fc112c5 (diff)
downloadbot-games-abe748bcfbb9bff0c358d0e2b6dd5aee6c4a29a9.tar.gz
bot-games-abe748bcfbb9bff0c358d0e2b6dd5aee6c4a29a9.zip
better way of getting the package of a game
Diffstat (limited to 'lib/Bot')
-rw-r--r--lib/Bot/Games.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Bot/Games.pm b/lib/Bot/Games.pm
index ac5df25..be50f4d 100644
--- a/lib/Bot/Games.pm
+++ b/lib/Bot/Games.pm
@@ -1,5 +1,6 @@
package Bot::Games;
use Bot::Games::OO;
+use List::Util qw/first/;
use Module::Pluggable
search_path => 'Bot::Games::Game',
sub_name => 'games';
@@ -125,7 +126,7 @@ sub valid_game {
sub game_package {
my $self = shift;
my ($name) = @_;
- return 'Bot::Games::Game::' . ucfirst($name);
+ return first { /\Q::$name\E$/i } $self->games;
}
sub game_list {