Skip to content

CGI::Application

Official Website: CPAN

Blurb:

Framework for building reusable web-applications

Longer Blurb:

CGI::Application makes it easier to create sophisticated, high-performance, reusable web-based applications. CGI::Application helps makes your web applications easier to design, write, and evolve.

CGI::Application judiciously avoids employing technologies and techniques which would bind a developer to any one set of tools, operating system or web server.

It is lightweight in terms of memory usage, making it suitable for common CGI environments, and a high performance choice in persistent environments like FastCGI or mod_perl.

By adding PLUG-INS as your needs grow, you can add advanced and complex features when you need them.

First released in 2000 and used and expanded by a number of professional website developers, CGI::Application is a stable, reliable choice.

How:

Follow the local::lib and PSGI/Plack instructions first.

Then install (along with some useful additions) via:

cpanm CGI::Application cgiapp-starter CGI::Application::PSGI

Hello World

Use the cgiapp-starter helper script to generate a Hello World app:

cgiapp-starter --module=HelloCGIApplication --author="Patrick Donelan" --email=pat@patspam.com
cd HelloCGIApplication
cpanm -n . # skip tests (fails on boilerplate warnings etc..)

app.psgi

CGI::Application supports Plack, so our goal here is to create an app.psgi file that can be used to run our app:

# app.psgi
use HelloCGIApplication;

my $handler = sub {
    my $env = shift;
    my $app = HelloCGIApplication->new({ QUERY => CGI::PSGI->new($env) });
    CGI::Application::PSGI->run($app);
};

Run it!
Now that your app.psgi file has been created, you can choose any of the deployment options listed on the Plack page.

Live Demos:

http://hostmonster.perlsharedhosting.com/cgi-application

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS