blob: 78b48db427379c032e56ed35499f763e45a227fb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
|