diff options
author | Jesse Luehrs <doy@tozt.net> | 2010-07-19 19:21:54 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2010-07-19 19:21:54 -0500 |
commit | d1bab5d4a5ea4100803c871461c62744767c514b (patch) | |
tree | 1e596286d921bdd58e2bc61eef5aff1c91a70e1b /t/lib/Command/Role/Class.pm | |
parent | 636f22f307ff0dc94a2c2ec23d49c872ecddbc02 (diff) | |
download | moosex-exporter-easy-d1bab5d4a5ea4100803c871461c62744767c514b.tar.gz moosex-exporter-easy-d1bab5d4a5ea4100803c871461c62744767c514b.zip |
Diffstat (limited to 't/lib/Command/Role/Class.pm')
-rw-r--r-- | t/lib/Command/Role/Class.pm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/lib/Command/Role/Class.pm b/t/lib/Command/Role/Class.pm new file mode 100644 index 0000000..78b48db --- /dev/null +++ b/t/lib/Command/Role/Class.pm @@ -0,0 +1,26 @@ +package Command::Role::Class; +use Moose::Role; + +sub get_all_commands { + my ($self) = @_; + grep { Moose::Util::does_role($_, 'Command::Role::Method') } + $self->get_all_methods; +} + +sub has_command { + my ($self, $name) = @_; + my $method = $self->find_method_by_name($name); + return unless $method; + return Moose::Util::does_role($method, 'Command::Role::Method'); +} + +sub get_command { + my ($self, $name) = @_; + my $method = $self->find_method_by_name($name); + return unless $method; + return Moose::Util::does_role($method, 'Command::Role::Method') + ? $method + : (); +} + +1; |