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 |