JSON::...ispatch(3pm)

🌸 NAME 🌸

okay so this is the JSON::...ispatch(3pm) page from the User Contributed Perl Documentation, bestie ✨ the module's actual name is JSON::RPC::Dispatch, and its whole thing is Dispatch JSON RPC Requests To Handlers. that's the name, that's the assignment, no cap πŸ’…


✨ SYNOPSIS ✨

here's the starter pack, literally exactly as written β€” do not come for me about the formatting, i copied it character for character 🫢

           use JSON::RPC::Dispatch;

           my $router = Router::Simple->new; # or use Router::Simple::Declare
           $router->connect( method_name => {
               handler => $class_name_or_instance,
               action  => $method_name_to_invoke
           );

           my $dispatch = JSON::RPC::Dispatch->new(
               router => $router
           );

           sub psgi_app {
               $dispatch->handle_psgi( $env );
           }

the vibe is: make a Router::Simple (or use Router::Simple::Declare), connect a method_name to a hashref with handler and action, build your JSON::RPC::Dispatch with router => $router, then in psgi_app call $dispatch->handle_psgi( $env ). iconic little flow, ngl 🌈


πŸ’– DESCRIPTION πŸ’–

short and sweet, fr fr: See docs in JSON::RPC for details 😭 that's the whole description. so go read the JSON::RPC docs for the details, iykyk πŸ¦‹


mwah πŸ’‹ sign-off time: this footer energy is source/version perl v5.42.0, date 2015-08-27, and the footer label JSON::...ispatch(3pm). slay, periodt 🫢✨

πŸ“¦ where this page comes from