You're welcome to just use CGI (if your webserver supports it). It's deprecated because it's a poor foundation for a full application not because it's not useful and easy.
use strictures; use CGI ":standard"; use HTML::Entities; # Called https://mysite/cgi-bin/rpc.pl?args=to;the=call my $explicitly_scalar_param = param("args"); my $the = param("the"); print header(), start_html("Title..."), h1("header"), div("Do something safely with", encode_entities($explicitly_scalar_param), "and", encode_entities($the)), end_html; # Test on command line: ./rpc.pl 'args=to;the=call'
A *minimalist* modern take. If the thing is to grow, it should be in a framework like Mojolicious and friends. This uses PSGI via Plack::Request and the command line tool plackup. There are many deployment options for PSGI; from plackup through uWSGI.
use strictures; use Plack::Request; # Called https://mysite/not-the-cgi-bin/rpc.pl?args=to;the=call sub { my $req = Plack::Request->new(+shift); my $args = $req->parameters->{args}; my $the = $req->parameters->{the}; [ 200, [ "Content-Type" => "text/html" ], [ "HTML tags + output. You HTML encode ALL unknown data." ] ]; }; # Command line: plackup rpc.pl # HTTP::Server::PSGI: Accepting connections at http://0:5000/ # -> port 5000 on localhost ^^^
Update: the PSGI version would not go in the cgi-bin.
In reply to Re: Recommendation: CGI for a remote procedure call
by Your Mother
in thread Recommendation: CGI for a remote procedure call
by BernieC
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |