JSON::RPC::LWP(3pm)

πŸ“¦
version 0.007 Β· 2 versions
, in fedora 43

πŸ’– JSON::RPC::LWP πŸ’–

okay so bestie, this is JSON::RPC::LWP β€” a User Contributed Perl Documentation page, and honestly? it's giving "do JSON RPC over literally any libwww-supported transport protocol, any version, no cap." ✨


🌸 NAME 🌸

JSON::RPC::LWP β€” Use any version of JSON RPC over any libwww supported transport protocols. fr fr, any version, any transport. πŸ’…


πŸŽ€ VERSION πŸŽ€

version 0.007 β€” yes it's giving very early-release main character energy but it works, okay? 🫢


✨ SYNOPSIS ✨

look at this, it's so clean:

use JSON::RPC::LWP;

my $rpc = JSON::RPC::LWP->new(
  from  => 'name@address.com',
  agent => 'Example ',
);

my $login = $rpc->call(
  'https://us1.lacunaexpanse.com/empire', # uri
  'login', # service
  [$empire,$password,$api_key] # JSON container
);

literally that's it. you're an RPC girlie now. πŸ‘‘


πŸ¦‹ METHODS πŸ¦‹

call( $uri, $method )

call( $uri, $method, {...} )

call( $uri, $method, [...] )

call( $uri, $method, param1, param2, ... )

  • Initiates a JSON::RPC::Common::Procedure::Call πŸ’œ
  • Uses LWP::UserAgent for transport. that's the ride, we're just along for it. πŸš—
  • Then returns a JSON::RPC::Common::Procedure::Return
  • To check for an error, use the has_error method of the returned object. do not skip this step bestie. 😭

notify( $uri, $method )

notify( $uri, $method, {...} )

notify( $uri, $method, [...] )

notify( $uri, $method, param1, param2, ... )

  • Initiates a JSON::RPC::Common::Procedure::Call
  • Uses LWP::UserAgent for transport.
  • Basically this is the same as a call, except without the id key, and it doesn't expect a JSON RPC result. so it's like the lowkey version. no reply needed, she's unbothered. πŸ™ˆ
  • Returns the HTTP::Response from ua.
  • To check for an error, use the is_error method of the returned response object.

πŸ’… ATTRIBUTES πŸ’…

previous_id

This attribute is deprecated, and will always return 1 immediately after a call. okay so it's retired but still showing up to the group chat. πŸ’€

has_previous_id

Returns true if the previous_id has any value associated with it.

This method is deprecated.

clear_previous_id

This method is deprecated.

Clears the previous id β€” useful for generators that do something different the first time they are used. πŸŒ€

id_generator

This attribute is deprecated, and is no longer used.

If you modified it in a subclass:

has '+id_generator' => (
  default => sub{sub{1}},
);

You should change it to only be modified on older versions of this module.

unless( eval{ JSON::RPC::LWP->VERSION(0.007); 1 } ){
  # was always called with ( id => "1" )
  has '+id_generator' => (
    default => sub{sub{1}},
  );
}

If anyone was actually relying on this feature it might get added back in. so like... speak now or forever hold your peace. πŸ€·β™€οΈ

version

The JSON RPC version to use. one of 1.0 1.1 or 2.0. pick your fighter. ⭐

agent

Get/set the product token that is used to identify the user agent on the network. The agent value is sent as the User-Agent header in the requests. The default is the string returned by the _agent attribute (see below).

If the agent ends with space then the _agent string is appended to it. (yes, the trailing space matters β€” it's a whole thing. 🫢)

The user agent string should be one or more simple product identifiers with an optional version number separated by the / character.

Setting this will also set ua->agent and marshal->user_agent. two-for-one, we love an efficient queen. πŸ‘‘

_agent

Returns the default agent identifier. This is a string of the form JSON-RPC-LWP/#.###, where #.### is substituted with the version number of this library.

marshal

An instance of JSON::RPC::Common::Marshal::HTTP. This is used to convert from a JSON::RPC::Common::Procedure::Call to a HTTP::Request, and from an HTTP::Response to a JSON::RPC::Common::Procedure::Return. it's the translator bestie, she speaks both languages. 🌈

Attributes delegated to marshal:

  • prefer_get
  • rest_style_methods
  • prefer_encoded_get

ua

An instance of LWP::UserAgent. This is used for the transport layer. 🚚

Attributes delegated to ua:

  • timeout
  • proxy
  • no_proxy
  • env_proxy
  • from
  • credentials

🌟 AUTHOR 🌟

Brad Gilbert <b2gills@gmail.com> β€” ty for your service king 🫑


This software is copyright (c) 2011 by Brad Gilbert.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


and that's the whole page bestie, no notes, periodt. πŸ’–

this was JSON::RPC::LWP, from perl v5.42.0, dated 2025-07-25 β€” go forth and RPC responsibly, mwah πŸŽ€πŸ’‹

πŸ“¦ where this page comes from