CGI reviews

RSS | Module Info

CGI (3.63) ** is the grand old man of Perl web programming. It is not generally considered to be the state of the art any more. While it's still maintained for bugs, and occasional minor new features are added, don't expect too many exciting new ground-breaking features to be added. essentially has two main areas of functionality:

1. handling communication with the web server via the CGI protocol (parsing query strings, interpreting environment variables, outputting HTTP headers, etc); and
2. generating HTML using function calls.

It seems to be fairly widely agreed that the HTML generation part is best forgotten about - instead, try a template module like Text::Template or Template::Toolkit, or try building an in-memory object which can be serialized to (X)HTML, like an XML::LibXML document.

The CGI protocol stuff is more reasonable to be using into the 21st century, however it does limit your scripts to running via the CGI protocol. Developing using Plack, or a Plack-based framework instead allows you to write scripts that run not just via CGI but in other environments (mod_perl, FastCGI, etc) too.

The API is somewhat odd, as it offers both object-oriented and functional interfaces and allows you to switch between them at will. Frameworks like CGI::Application and CGI::Snapp go some way to protecting you from that.