diff options
Diffstat (limited to 't/lib/Command')
-rw-r--r-- | t/lib/Command/Role/Class.pm | 26 | ||||
-rw-r--r-- | t/lib/Command/Role/Method.pm | 4 |
2 files changed, 30 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; diff --git a/t/lib/Command/Role/Method.pm b/t/lib/Command/Role/Method.pm new file mode 100644 index 0000000..29152ac --- /dev/null +++ b/t/lib/Command/Role/Method.pm @@ -0,0 +1,4 @@ +package Command::Role::Method; +use Moose::Role; + +1; |