MojoX::...patcher(3)
π MojoX::JSON::RPC::Dispatcher π
okay bestie, pull up a chair, because this is the page for MojoX::...patcher(3) from the User Contributed Perl Documentation, and honestly? it's a whole vibe. β¨
πΈ NAME πΈ
MojoX::JSON::RPC::Dispatcher β a JSON-RPC 2.0 server for Mojolicious. yes. that's the job. it serves. π
π SYNOPSIS π
here's the whole setup, copy-paste style, no cap:
# lib/your-application.pm
use base 'Mojolicious';
use MojoX::JSON::RPC::Service;
sub startup {
my $self = shift;
my $svc = MojoX::JSON::RPC::Service->new;
$svc->register(
'sum',
sub {
my @params = @_;
my $sum = 0;
$sum += $_ for @params;
return $sum;
}
);
$self->plugin(
'json_rpc_dispatcher',
services => {
'/jsonrpc' => $svc
}
);
}
look at that. registering a 'sum' service, wiring up the 'json_rpc_dispatcher' plugin with services => { '/jsonrpc' => $svc }. iconic behaviour, fr fr. π«Ά
π¦ DESCRIPTION π¦
so the tea is: using this module you can handle JSON-RPC 2.0 requests within Mojolicious. that's it, that's the whole pitch. you get JSON-RPC 2.0 request handling, right inside Mojolicious, and it's giving main character energy. ππ
β¨ ATTRIBUTES β¨
MojoX::JSON::RPC::Dispatcher inherits all attributes from Mojolicious::Controller (yes, all of them, the whole family tree π³) and implements the following attributes of its very own:
π« json
JSON encoder / decoder. she encodes. she decodes. she does it all. π
π« error_code
Error code.
π« error_message
Error message.
π« error_data
Error data.
π« id
the id. just id. short, sweet, mysterious. π
π₯ METHODS π₯
MojoX::JSON::RPC::Dispatcher inherits all methods from Mojolicious::Controller and implements the following new ones:
π call
Process JSON-RPC call. do it. slay. β
π SEE ALSO π
MojoX::JSON::RPCMojolicious::Plugin::JsonRpcDispatcher
go read those too, iykyk. πβ¨
lowkey reminder: everything above is exactly as the original says it β the attributes, the inheritance, the methods, the references. i'm just here to make it cute. π
okay that's the whole page, bestie!! this was perl v5.42.0, dated 2025-07-25, and it's from the User Contributed Perl Documentation. thanks for coming to my ted talk, mwah ππΈπ
π¦ where this page comes from
- fedora 43: perl-MojoX-JSON-RPC 0.13-14.fc43 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms