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.
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.
sub cgi (&) { ... }
to be kind of weird and awkward:
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: