diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-06-01 23:15:03 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-06-01 23:21:28 -0500 |
commit | abe748bcfbb9bff0c358d0e2b6dd5aee6c4a29a9 (patch) | |
tree | 8e1f843e6c7366d585611d6c4dd780eb2ba22bc8 /lib/Bot/Games.pm | |
parent | dd43ac4f9fcd4b06824e070ac822e1928fc112c5 (diff) | |
download | bot-games-abe748bcfbb9bff0c358d0e2b6dd5aee6c4a29a9.tar.gz bot-games-abe748bcfbb9bff0c358d0e2b6dd5aee6c4a29a9.zip |
better way of getting the package of a game
Diffstat (limited to 'lib/Bot/Games.pm')
-rw-r--r-- | lib/Bot/Games.pm | 3 |
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 { |