1MojoX::JSON::RPC::DispaUtscehrerC:o:nMtertihboudt(e3d)PMeorjloXD:o:cJuSmOeNn:t:aRtPiCo:n:Dispatcher::Method(3)
2
3
4

NAME

6       MojoX::JSON::RPC::Dispatcher::Method - The data holder between RPC
7       requests and responses.
8

SYNOPSIS

10           use MojoX::JSON::RPC::Dispatcher::Method;
11
12           my $meth = MojoX::JSON::RPC::Dispatcher::Method->new(
13              method => 'sum',
14              id     => 1
15           );
16
17           $meth->error_code(300);
18

DESCRIPTION

20       This module is heavily inspired by JSON::RPC::Dispatcher::Procedure.
21

ATTRIBUTES

23       MojoX::JSON::RPC::Dispatcher::Method implements the following
24       attributes.
25
26   "id"
27       Request id.
28
29   "method"
30       Request method name.
31
32   "params"
33       Request parameters.
34
35   "result"
36       Request result.
37
38   "is_notification"
39       Indicates whether request is a notification.
40
41   "error_code"
42       Error code.
43
44   "error_message"
45       Error message.
46
47   "error_data"
48       Error data.
49

METHODS

51       MojoX::JSON::RPC::Dispatcher::Method inherits all methods from
52       Mojo::Base and implements the following new ones.
53
54   "clear_error"
55       Clear error code, message and data.
56
57   "error"
58       Set error code and message. Optionally set some error data.
59
60           $proc->error(-32602, 'Invalid params');
61
62           $proc->error(-32603, 'Internal error.', '...');
63
64   "has_error"
65       Returns a boolean indicating whether an error code has been set.
66
67   "internal_error"
68       Sets an Internal Error as defined by the JSON-RPC 2.0 spec.
69
70           $proc->internal_error;
71
72           $proc->internal_error('...');
73
74   "invalid_params"
75       Sets an Invalid Params error as defined by the JSON-RPC 2.0 spec.
76
77           $proc->invalid_params;
78
79           $proc->invalid_params('...');
80
81   "invalid_request"
82       Sets an Invalid Request error as defined by the JSON-RPC 2.0 spec.
83
84           $proc->invalid_request;
85
86           $proc->invalid_request('...');
87
88   "method_not_found"
89       Sets a Method Not Found error as defined by the JSON-RPC 2.0 spec.
90
91           $proc->method_not_found;
92
93           $proc->method_not_found('...');
94
95   "parse_error"
96       Sets a Parse error as defined by the JSON-RPC 2.0 spec.
97
98           $proc->parse_error;
99
100           $proc->parse_error('...');
101
102   "response"
103       Formats the data stored in this object into the data structure expected
104       by MojoX::JSON::RPC::Dispatcher, which will ultimately be returned to
105       the client.
106
107           my $res = $meth->response;
108

SEE ALSO

110       MojoX::JSON::RPC::Dispatcher, JSON::RPC::Dispatcher::Procedure
111
112
113
114perl v5.34.0                      2022-0M1o-j2o1X::JSON::RPC::Dispatcher::Method(3)
Impressum