2022 twenty-four merry days of Perl Feed


App::CGIThis - 2022-12-04

As is the case in most public sector institutions, a lot of the tools at the North Pole are out of date. The elves often need to work with terrible spaghetti CGI scripts that are still around from the olden days. Quite a few of their internal tools with web interfaces are still implemented using CGI, and despite the ongoing effort by the elves to port them over to Plack, several of the more critical tools are still mostly untouched. After all, why change a running system?

Of course the original development infrastructure has long since disappeared. Just a few Christmases ago they "lost" the last remaining CGI development box when a very desperate sysadmin somewhere in a small town in Texas in the United States wanted nothing more than a working Debian Woody machine. (Some of the elves still wonder how Santa got that bulky server into the guy's stocking).

The elves had to come up with an alternative.

Enter App::CGIThis

One of the tools the elves have been using for a long time when making websites is http_this, the script that ships with App::HTTPThis. It lets them access a folder full of files from their browser by creating a simple web server via Plack::Runner.

One clever elf recently discovered that you could also do this with CGI scripts. After a bit of tinkering they are now using App::CGIThis and the cgi_this command whenever they have to debug one of these old CGI scripts.

    $ cgi_this
    Exporting '.', available at:

    Found the following scripts:

If run with no arguments, it simply turns the whole current directory into a CGI script serving web server that listens on port 3000. The elves like this to test quick fixes to the configuration-heavy scripts that they haven't managed to migrate yet.

The two remaining original CGI elves think this is not necessary, because they could of course make these changes in production, claiming the younger elf generation is too scared to get things done, but luckily the head elf is heaving none of that. Instead, these two now use cgi_this with the --cgi-bin flag, which makes the URLs look more like what they are used to.

    $ cgi_this --cgi-bin
    Exporting '.', available at:

    Found the following scripts:

So, despite the selfless act of giving their last old machine to a fellow techie in need, they can still safely test their work whenever they have to debug one of the old scripts.

Gravatar Image This article contributed by: Julien Fiegehenn <simbabque@cpan.org>