An app using the CGI::Application::PSGI framework needs the app.psgi and requirements.txt files.
In the requirements.txt file, list any module requirements, with at least the following:
CGI::Application::PSGI
Plack::Builder
In the app.psgi file, the basic code will be similar to the following:
#perl
use lib "lib";
use strict;
use Plack::Builder;
use CGI::Application::PSGI;
use AppCore;
my $handler = sub {
my $env = shift;
my $app = AppCore->new({ QUERY => CGI::PSGI->new($env) });
CGI::Application::PSGI->run($app);
};
builder {
enable 'Plack::Middleware::ContentLength';
$handler;
};
In the above example, AppCore.pm is located in the local lib directory and handles processing of
the data and the response as per the
CGI::Application documentation.
Note
The Plack::Middleware::ContentLength code adds the Content-Length header which is
currently required for Perl apps under Helion Stackato.