Main Content

Using CGI and Perl to put a simple application online. Sometimes still the best way.

Archive - Originally posted on "The Horse's Mouth" - 2012-09-30 10:08:38 - Graham Ellis

These days, it's fashionable to embed Perl, PHP, Python or Rails within a web framework if you want to put your application code online - in other words, if you want to take logic that's tried and tested and make it web available. And there's much to be said for this fashion - it provides a whole series of facilities and security checks which you don't have to keep re-coding yourself. If you're writing substantial systems, I'll encourage you to use such a framework, and indeed I'll introduce to you Django or Rails as an extra day on the end of your Python or Ruby course.

BUT ... if you just want to add a simple, one-page script onto your web site, there's still a lot to be said for KISS - "Keep It Simple, Stupid" - and that can be achieved through the Perl and the Common Gateway Interface.

On last week's Perl course, I wrote a complete CGI example that looks up data from within a large data file - a simple, single page filtering application. It's robust, secure, easy to use and it doesn't use any of the complicated day-to-even-start frameworks. Source code [here]; data file [here].