1JSON::RPC::Legacy::ServUesre:r:DCaoenmtorni(b3u)ted PerlJSDOoNc:u:mRePnCt:a:tLieognacy::Server::Daemon(3)
2
3
4

NAME

6       JSON::RPC::Legacy::Server::Daemon - JSON-RPC sever for daemon
7

SYNOPSIS

9        # Daemon version
10        #--------------------------
11        # In your daemon server script
12        use JSON::RPC::Legacy::Server::Daemon;
13
14        JSON::RPC::Legacy::Server::Daemon->new(LocalPort => 8080);
15                                 ->dispatch({'/jsonrpc/API' => 'MyApp'})
16                                 ->handle();
17
18        #--------------------------
19        # In your application class
20        package MyApp;
21
22        use base qw(JSON::RPC::Legacy::Procedure); # Perl 5.6 or more than
23
24        sub echo : Public {    # new version style. called by clients
25            # first argument is JSON::RPC::Legacy::Server object.
26            return $_[1];
27        }
28
29        sub sum : Public(a:num, b:num) { # sets value into object member a, b.
30            my ($s, $obj) = @_;
31            # return a scalar value or a hashref or an arryaref.
32            return $obj->{a} + $obj->{b};
33        }
34
35        sub a_private_method : Private {
36            # ... can't be called by client
37        }
38
39        sub sum_old_style {  # old version style. taken as Public
40            my ($s, @arg) = @_;
41           return $arg[0] + $arg[1];
42        }
43

DESCRIPTION

45       This module is for http daemon servers using HTTP::Daemon or
46       HTTP::Daemon::SSL.
47

METHODS

49       They are inherited from the JSON::RPC::Legacy::Server methods
50       basically.  The below methods are implemented in
51       JSON::RPC::Legacy::Server::Daemon.
52
53       new Creates new JSON::RPC::Legacy::Server::Daemon object.  Arguments
54           are passed to HTTP::Daemon or HTTP::Daemon::SSL.
55
56       handle
57           Runs server object and returns a response.
58
59       retrieve_json_from_post
60           retrieves a JSON request from the body in POST method.
61
62       retrieve_json_from_get
63           In the protocol v1.1, 'GET' request method is also allowable.  it
64           retrieves a JSON request from the query string in GET method.
65
66       response
67           returns a response JSON data to a client.
68

SEE ALSO

70       HTTP::Daemon,
71
72       HTTP::Daemon::SSL,
73
74       JSON::RPC::Legacy::Server,
75
76       JSON::RPC::Legacy::Procedure,
77
78       JSON,
79
80       <http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html>,
81
82       <http://json-rpc.org/wiki/specification>,
83

AUTHOR

85       Makamaka Hannyaharamitu, <makamaka[at]cpan.org>
86
88       Copyright 2007-2008 by Makamaka Hannyaharamitu
89
90       This library is free software; you can redistribute it and/or modify it
91       under the same terms as Perl itself.
92
93
94
95perl v5.32.1                      2021-01-2J7SON::RPC::Legacy::Server::Daemon(3)
Impressum