line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::RPC2; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
52131
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
404
|
|
4
|
2
|
|
|
2
|
|
15
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
71
|
|
5
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
269
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
2679
|
use version; our $VERSION = qv('1.0.0'); # update Changes & README |
|
2
|
|
|
|
|
7249
|
|
|
2
|
|
|
|
|
14
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
11
|
|
|
|
|
|
|
__END__ |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
JSON::RPC2 - Transport-independent implementation of json-rpc 2.0 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
See L<JSON::RPC2::Server> and L<JSON::RPC2::Client> for usage examples. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This module implement json-rpc 2.0 protocol in transport-independent way. |
26
|
|
|
|
|
|
|
It was very surprising for me to find on CPAN a lot of transport-dependent |
27
|
|
|
|
|
|
|
implementations of (by nature) transport-independent protocol! |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Also it support non-blocking client remote procedure call and both |
30
|
|
|
|
|
|
|
blocking and non-blocking server method execution. This can be very useful |
31
|
|
|
|
|
|
|
in case server methods will need to do some RPC or other slow things like |
32
|
|
|
|
|
|
|
network I/O, which can be done in parallel with executing other server |
33
|
|
|
|
|
|
|
methods in any event-based environment. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 INTERFACE |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
See L<JSON::RPC2::Server> and L<JSON::RPC2::Client> for details. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 RATIONALE |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
There a lot of other RPC modules on CPAN, most of them has features doesn't |
44
|
|
|
|
|
|
|
provided by this module, but they either too complex and bloated or lack |
45
|
|
|
|
|
|
|
some features I need. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=over |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item L<RPC::Lite> |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Not transport-independent. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item L<RPC::Simple> |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Not transport-independent. |
56
|
|
|
|
|
|
|
Do eval() of perl code received from remote server. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item L<RPC::Async> |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Not transport-independent. |
61
|
|
|
|
|
|
|
Not event-loop-independent. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item L<JSON::RPC> |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item L<RPC::JSON> |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item L<RPC::Object> |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item L<Event::RPC> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item L<RPC::Serialized> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item L<XML::RPC> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item L<RPC::XML> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Not transport-independent. |
78
|
|
|
|
|
|
|
Blocking on remote function call. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item L<JSON::RPC::Common> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
In theory it's doing everything... but I failed to find out how to use it |
83
|
|
|
|
|
|
|
(current version is 0.05) - probably it's incomplete yet. Even now it's |
84
|
|
|
|
|
|
|
too complex and bloated for me, I prefer small and simple solutions. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=back |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
None. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 CONFIGURATION AND ENVIRONMENT |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
JSON::RPC2 requires no configuration files or environment variables. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
JSON::XS |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 INCOMPATIBILITIES |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
None reported. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
No bugs have been reported. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
114
|
|
|
|
|
|
|
C<bug-json-rpc2@rt.cpan.org>, or through the web interface at |
115
|
|
|
|
|
|
|
L<http://rt.cpan.org>. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 AUTHOR |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Alex Efros C<< <powerman-asdf@ya.ru> >> |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Copyright (c) 2009,2013,2014 Alex Efros C<< <powerman-asdf@ya.ru> >>. All rights reserved. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or |
128
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. See L<perlartistic>. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTY |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
134
|
|
|
|
|
|
|
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
135
|
|
|
|
|
|
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
136
|
|
|
|
|
|
|
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER |
137
|
|
|
|
|
|
|
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
138
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE |
139
|
|
|
|
|
|
|
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH |
140
|
|
|
|
|
|
|
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL |
141
|
|
|
|
|
|
|
NECESSARY SERVICING, REPAIR, OR CORRECTION. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
144
|
|
|
|
|
|
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
145
|
|
|
|
|
|
|
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE |
146
|
|
|
|
|
|
|
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, |
147
|
|
|
|
|
|
|
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE |
148
|
|
|
|
|
|
|
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
149
|
|
|
|
|
|
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
150
|
|
|
|
|
|
|
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
151
|
|
|
|
|
|
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
152
|
|
|
|
|
|
|
SUCH DAMAGES. |