% cat > app.cgi package main; use Plack::Request; my $app = sub { my $env = shift; my $req = Plack::Request->new($env); my $params = $req->parameters; return [ 200, [ "Content-Type" => "text/plain" ], [ map { sprintf ("%s = %s\n", $_ => $params->get($_)) } $params->keys ] ]; }; Plack::Handler::CGI->new->run($app); % cat `perldoc -l Plack::Handler::CGI` app.cgi > app_bundled.cgi Plack::Request comes with Plack. --d 2013/6/2 Eric Brine <ikegami@adaelis.com> > On Tue, May 28, 2013 at 7:57 AM, Tatsuhiko Miyagawa <miyagawa@gmail.com>wrote: > >> On Tue, May 28, 2013 at 8:28 PM, Johan Vromans <jvromans@squirrel.nl> >> wrote: >> > Aristotle Pagaltzis <pagaltzis@gmx.de> writes: >> > >> > The bottom line is that my CGI solution requires 10-20 lines of code, >> > works out of the box on any web host with Perl, without the need for >> > additional modules and server (re)configuration. >> > >> > I have yet to see Plack code that does the same. >> >> % cat > app.cgi >> package main; >> >> my $app = sub { >> return [ 200, [ "Content-Type", "text/html" ], [ "Hello" ] ]; >> }; >> Plack::Handler::CGI->new->run($app); >> >> % cat `perldoc -l Plack::Handler::CGI` app.cgi > app_bundled.cgi >> > > A program that takes no input is useless. What would it take to also > process query and POST params? > >Thread Previous | Thread Next