From 892366afd72b42858459e54beb32600f2e85d508 Mon Sep 17 00:00:00 2001 From: doy Date: Mon, 27 Apr 2009 17:47:33 -0500 Subject: allow passing args to the command sub even when we don't pass a coderef --- lib/Bot/Games/OO/Game.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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'); -- cgit v1.2.3-54-g00ecf