paperlined.org
dev > perl > modules > related_modules
document updated 3 months ago, on Jun 3, 2022

Alternatives to CGI.pm

CGI.pm clearly states at the top of its documentation that "CGI.pm is no longer considered good practice for developing web applications, including quick prototyping and small web scripts."

A documentation-only module has been released called CGI::Alternatives which lists a few alternatives to using CGI.pm. However, it mainly suggests heavyweight frameworks like Template Toolkit, Mojolicious, Dancer2, Catalyst, etc. That's usually not I would ever use CGI.pm for.

It does suggest CGI::Tiny as a smaller alternative, however, I find CGI::Tiny's use of CGI::Tiny::cgi() to be a little weird:

"There is no CGI::Tiny object constructor; the object is accessible within the cgi block"

I usually want to just do some basic HTML-escaping or URL-escaping, or once in a while, parsing of the QUERY_STRING, the POST body, or cookies.

Lightweight replacements for CGI.pm

Things that just do URL escaping:

Things that just do HTML escaping:

Things that just parse application/x-www-form-urlencoded and multipart/form-data:

Things that just parse cookies: