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'
####
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 ^^^