blob: 0c031d366bcc937851fd3b4a02a493a8fca6c0d3 (
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 Net::HTTP::Console::Dispatcher::Method;
use MooseX::Declare;
class Net::HTTP::Console::Dispatcher::Method with Net::HTTP::Console::Dispatcher {
method dispatch($input) {
(my $method, my $args) = $input =~ /^(\w+)\s(.*)$/;
my ($content, $response) =
$self->application->api_object->$method(%{JSON::decode_json($args)});
$self->application->_set_and_show($content, $response);
1;
}
method pattern($input) {
(my $method) = $input =~ /^(\w+)/;
# XXX find_api_method_by_name ?
$self->application->api_object->meta->find_method_by_name($method)
? return $input
: return 0;
}
}
1;
|