diff options
author | doy <doy@tozt.net> | 2009-04-27 17:47:33 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2009-04-27 17:47:33 -0500 |
commit | 892366afd72b42858459e54beb32600f2e85d508 (patch) | |
tree | fab27f6451b3a80298d2b0d8355fbaf44186f856 | |
parent | 01317ece9f8b8b07d438afcbd6de2df557fac4fe (diff) | |
download | bot-games-892366afd72b42858459e54beb32600f2e85d508.tar.gz bot-games-892366afd72b42858459e54beb32600f2e85d508.zip |
allow passing args to the command sub even when we don't pass a coderef
-rw-r--r-- | lib/Bot/Games/OO/Game.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Bot/Games/OO/Game.pm b/lib/Bot/Games/OO/Game.pm index 972584e..3921a0d 100644 --- a/lib/Bot/Games/OO/Game.pm +++ b/lib/Bot/Games/OO/Game.pm @@ -3,7 +3,11 @@ use Bot::Games::OO (); sub command { my $class = shift; - my ($name, $code, %args) = @_; + my $name = shift; + my $code; + $code = shift if ref($_[0]) eq 'CODE'; + my %args = @_; + my $method_meta = $class->meta->get_method($name); my $superclass = Moose::blessed($method_meta) || 'Moose::Meta::Method'; my @method_metaclass_roles = ('Bot::Games::Trait::Method::Command'); |