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

Re: is dead, long live

Thread Previous | Thread Next
Tatsuhiko Miyagawa
June 2, 2013 15:22
Re: is dead, long live
Message ID:
On Sun, Jun 2, 2013 at 2:03 PM, Eric Brine <> 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 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About