develooper Front page | perl.perl5.porters | Postings from June 2013

Re: CGI.pm is dead, long live CGI.pm

Thread Previous | Thread Next
From:
Tatsuhiko Miyagawa
Date:
June 2, 2013 15:22
Subject:
Re: CGI.pm is dead, long live CGI.pm
Message ID:
CADGpoaOzKEq0kd2O9MV7oeo9vn__B8Eme-GkFE=9mzPD2EjqLg@mail.gmail.com
On Sun, Jun 2, 2013 at 2:03 PM, Eric Brine <ikegami@adaelis.com> wrote:
>>
>>     % 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?

As mentioned in other email, you can use Plack::Request to do the
same, while it will require more files and embedding them into a CGI
script is certainly possible with Fatpacker, but it will be much
easier if you do:

   % cpanm -l vendor Plack

and add:

    use lib './vendor/lib/perl5';

to your CGI scripts, then upload the whole directory to your host and
it will run, with or without CGI.pm installed.

If you like a module that has less dependencies, you can take a look
at Mojolicious, another excellent framework that supports PSGI out of
the box, with zero non-core dependencies.

--
Tatsuhiko Miyagawa

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About