diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-06-01 02:31:07 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-06-01 02:57:21 -0500 |
commit | 50bec03e267b34401bac32f7936686b7dc51088e (patch) | |
tree | c647502afcd694a9a3e5c32825a78439f03b9fa4 /lib/Bot/Games/Trait/Class/Command.pm | |
parent | 5d697170e22d75928a361e1c7b1d007632de29c1 (diff) | |
download | bot-games-50bec03e267b34401bac32f7936686b7dc51088e.tar.gz bot-games-50bec03e267b34401bac32f7936686b7dc51088e.zip |
move the code for getting a command into the command class trait
Diffstat (limited to 'lib/Bot/Games/Trait/Class/Command.pm')
-rw-r--r-- | lib/Bot/Games/Trait/Class/Command.pm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Bot/Games/Trait/Class/Command.pm b/lib/Bot/Games/Trait/Class/Command.pm index 3c242ae..462b9ea 100644 --- a/lib/Bot/Games/Trait/Class/Command.pm +++ b/lib/Bot/Games/Trait/Class/Command.pm @@ -18,6 +18,16 @@ after ((map { "add_${_}_method_modifier" } qw/before after around/) => sub { $method_metaclass->rebless_instance($method_meta, pass_args => $pass_args); }); +sub get_command { + my $self = shift; + my ($action) = @_; + my $method_meta = $self->find_method_by_name($action); + return $method_meta + if blessed($method_meta) + && $method_meta->meta->can('does_role') + && $method_meta->meta->does_role('Bot::Games::Trait::Method::Command'); +} + no Moose::Role; 1; |