blob: 08536f338c4e904db54abfa175768f448c121d82 (
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
27
28
29
30
31
|
package Net::HTTP::Console::Dispatcher::ExecuteMethod;
use Moose;
with qw/
Net::HTTP::Console::Dispatcher
Net::HTTP::Console::Role::HTTP
/;
sub dispatch {
my ($self, $input) = @_;
$input =~ /^(\w+)\s(.*)$/;
my $method = $1;
my $args = $2;
my $o = $self->lib->new();
my ($content, $response) = $o->$method(%{JSON::decode_json($args)});
$self->_set_and_show($content, $response);
}
sub pattern {
my ($self, $input) = @_;
$input =~ /^(\w+)/;
my $method = $1;
# find_api_method_by_name ?
if ($self->application->lib->meta->find_method_by_name($method)) {
return 1;
}else{
return 0;
}
}
1;
|