diff options
author | doy <doy@tozt.net> | 2009-01-14 22:09:59 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2009-01-14 22:09:59 -0500 |
commit | 7c535a1574c5f1a28d7fdd0ff66186385c5d12db (patch) | |
tree | 239e590b2354974d04ce2d9b4046b043bc3d0b91 /lib/Bot/Games/OO.pm | |
parent | 583f4006cf93aa0a13cae1975317cafd1eeeca23 (diff) | |
download | bot-games-7c535a1574c5f1a28d7fdd0ff66186385c5d12db.tar.gz bot-games-7c535a1574c5f1a28d7fdd0ff66186385c5d12db.zip |
add command and commands as options to 'has' for specifying generated methods as commands, and fix the command function to apply the role rather than use the alternate subclass
Diffstat (limited to 'lib/Bot/Games/OO.pm')
-rw-r--r-- | lib/Bot/Games/OO.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Bot/Games/OO.pm b/lib/Bot/Games/OO.pm index a44dcb4..8ed874a 100644 --- a/lib/Bot/Games/OO.pm +++ b/lib/Bot/Games/OO.pm @@ -9,13 +9,13 @@ use Bot::Games::Meta::Method::Command; sub command($&) { my $class = shift; my ($name, $code) = @_; - # XXX: is $class->meta what i want? should i be calling some form of - # ->initialize? should i be calling ->get_metaclass_by_name? who knows! - $class->meta->add_method($name, Bot::Games::Meta::Method::Command->wrap( + my $method_meta = Bot::Games::Meta::Method::Command->wrap( $code, package_name => $class, name => $name, - )); + ); + Moose::Util::apply_all_roles($method_meta, 'Bot::Games::Meta::Role::Command'); + $class->meta->add_method($name, $method_meta); } Moose::Exporter->setup_import_methods( |