in reply to Remove CGI.pm from Perl Core?

Tatsuhiko Miyagawa and Johan Vromans point out a very nice approach to creating a Plack stand-alone executable on p5p:

% 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

... or, creating a Mojolicious::Lite app:

$ cat > myapp.pl use Mojolicious::Lite; get '/' => sub { my $self = shift; $self->render(text => "Hi"); }; app->start;
The myapp.pl can work as a CGI, but also as a PSGI handler if you deploy to platforms that only supports PSGI apps and *not* CGI, such as Heroku, DotCloud and Stackato.

Replies are listed 'Best First'.
Re^2: Remove CGI.pm from Perl Core? (Plack / PSGI Stand-Alone)
by Anonymous Monk on May 28, 2013 at 18:58 UTC

    % cat `perldoc -l Plack::Handler::CGI` app.cgi > app_bundled.cgi

    Why not use fatpacker if you've got linux where fatpacker works ?

    OTOH that won't work as Plack::Handler::CGI has pod in __END__ section, so app.cgi is in __END__ section, so there is no app