1JSON::RPC::LWP(3) User Contributed Perl Documentation JSON::RPC::LWP(3)
2
3
4
6 JSON::RPC::LWP - Use any version of JSON RPC over any libwww supported
7 transport protocols.
8
10 version 0.007
11
13 use JSON::RPC::LWP;
14
15 my $rpc = JSON::RPC::LWP->new(
16 from => 'name@address.com',
17 agent => 'Example ',
18 );
19
20 my $login = $rpc->call(
21 'https://us1.lacunaexpanse.com/empire', # uri
22 'login', # service
23 [$empire,$password,$api_key] # JSON container
24 );
25
27 "call( $uri, $method )"
28 "call( $uri, $method, {...} )"
29 "call( $uri, $method, [...] )"
30 "call( $uri, $method, param1, param2, ... )"
31 Initiate a JSON::RPC::Common::Procedure::Call
32
33 Uses LWP::UserAgent for transport.
34
35 Then returns a JSON::RPC::Common::Procedure::Return
36
37 To check for an error use the "has_error" method of the returned
38 object.
39
40 "notify( $uri, $method )"
41 "notify( $uri, $method, {...} )"
42 "notify( $uri, $method, [...] )"
43 "notify( $uri, $method, param1, param2, ... )"
44 Initiate a JSON::RPC::Common::Procedure::Call
45
46 Uses LWP::UserAgent for transport.
47
48 Basically this is the same as a call, except without the "id" key,
49 and doesn't expect a JSON RPC result.
50
51 Returns the HTTP::Response from "ua".
52
53 To check for an error use the "is_error" method of the returned
54 response object.
55
57 "previous_id"
58 This attribute is deprecated, and will always return 1 immediately
59 after a call.
60
61 "has_previous_id"
62 Returns true if the "previous_id" has any value associated with it.
63
64 This method is deprecated.
65
66 "clear_previous_id"
67 This method is deprecated.
68
69 Clears the previous id, useful for generators that do something
70 different the first time they are used.
71
72 "id_generator"
73 This attribute is deprecated, and is no longer used.
74
75 If you modified it in a subclass:
76
77 has '+id_generator' => (
78 default => sub{sub{1}},
79 );
80
81 You should change it to only be modified on older versions of this
82 module.
83
84 unless( eval{ JSON::RPC::LWP->VERSION(0.007); 1 } ){
85 # was always called with ( id => "1" )
86 has '+id_generator' => (
87 default => sub{sub{1}},
88 );
89 }
90
91 If anyone was actually relying on this feature it might get added
92 back in.
93
94 "version"
95 The JSON RPC version to use. one of 1.0 1.1 or 2.0
96
97 "agent"
98 Get/set the product token that is used to identify the user agent
99 on the network. The agent value is sent as the "User-Agent" header
100 in the requests. The default is the string returned by the
101 "_agent" attribute (see below).
102
103 If the agent ends with space then the "_agent" string is appended
104 to it.
105
106 The user agent string should be one or more simple product
107 identifiers with an optional version number separated by the "/"
108 character.
109
110 Setting this will also set "ua->agent" and "marshal->user_agent".
111
112 "_agent"
113 Returns the default agent identifier. This is a string of the form
114 "JSON-RPC-LWP/#.###", where "#.###" is substituted with the version
115 number of this library.
116
117 "marshal"
118 An instance of JSON::RPC::Common::Marshal::HTTP. This is used to
119 convert from a JSON::RPC::Common::Procedure::Call to a
120 HTTP::Request, and from an HTTP::Response to a
121 JSON::RPC::Common::Procedure::Return.
122
123 Attributes delegated to "marshal"
124
125 "prefer_get"
126 "rest_style_methods"
127 "prefer_encoded_get"
128 "ua"
129 An instance of LWP::UserAgent. This is used for the transport
130 layer.
131
132 Attributes delegated to "ua"
133
134 "timeout"
135 "proxy"
136 "no_proxy"
137 "env_proxy"
138 "from"
139 "credentials"
140
142 Brad Gilbert <b2gills@gmail.com>
143
145 This software is copyright (c) 2011 by Brad Gilbert.
146
147 This is free software; you can redistribute it and/or modify it under
148 the same terms as the Perl 5 programming language system itself.
149
150
151
152perl v5.32.0 2020-07-28 JSON::RPC::LWP(3)