CGI Programming 201: Web Log (Blog) Program

One chapter (actually an appendix) of my new book covers how to create a web log program using Perl/CGI. If I'd realized just how popular blogging was before I started writing the book, I might have made it the focus of the entire book, rather than message boards. :) Fortunately message boards and blogs are so similar that they tie in well together.

I won't pretend this blog code is better than things like Movable Type or Blogger; certainly those programs have lots more features than this. But if you're the sort of person who likes to know how things work, and get your hands dirty with code, this is a good starting point. The blog code here is only 750 lines of code. From there you can (if you understand Perl/CGI programming) easily add the features you want, and customize your blog as you see fit.

The source code for all of the blog scripts is here.

You can also download a tar file containing all the scripts, if you're in a hurry and don't want to bother writing them from scratch. (You may want to read the README file first for system requirements and installation notes.) Of course, if you do use the blog code, I'd be quite grateful if you'd buy the book :) It's quite reasonably priced, and you'll also learn how to modify and customize your blog.

Here's an Example Blog you can try. If you use this code for your own blog and want to be listed here, please drop me a note.

Also if you want to use one of those "powered by" buttons that are so popular on other blogs, here's a little graphic for that:

And the source code (probably best to put it in the do_footer subroutine in

<a href=""><img src="" width=106 height=41 border=0></a>

Check back soon for additional extensions for the blog code (I'll have an RSS/XML addition for it soon).

Last revised Thursday, January 30, 2003

Table of Contents | Order the Book | CGI101 Home