JSON::RPC::Specをバージョンアップしました

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
use JSON::RPC::Spec;
my $rpc = JSON::RPC::Spec->new;
$rpc->register(
    'echo.{action}' => sub {
        my ($params, $matched) = @_;
        return $matched->{action};
    }
);
say $rpc->parse(
    '{"jsonrpc": "2.0", "method": "echo.hoge", "params": [1, 2, 3, 4, 5], "id": 1}'
);    # -> {"id":1,"result":"hoge","jsonrpc":"2.0"}
1
2
3
4
my $router = Router::Simple->new;
$router->connect( 'echo.{action}' => {
    handler => MyApp::Echo->new
);

Comments

comments powered by Disqus