Tom Paton's Homepage - Behind the Scenes

This page briefly describes the workings of this site, for those who are interested. It's basically a collection of links to the perl scripts that generate the page.

Back to Tom Paton's Homepage.

Perl Scripts

CGI.pl

This script handles all requests for .xml files. These requests are directed to this script by the .htaccess file. This script receives the details of the request via environment variables. It basically gets xmlwebpage.pl to generate a .html file from the requested .xml, updates the counters and returns the generated file. To save unnecessary generation (a little slow) it only regenerates the .html file if the .xml has been modified since the last generation or the file is unavailable or expired (greater than a day old). The hit count information is appended to the generated .html file. This page also determines if the referer was a search engine and if so, forces a generation of the web page with a "Search Results" section.

CGI.pl

xmlwebpage.pl

This script parses an .xml file (using XML::Parser) and spits out .html code to display the contents. It has nifty features like counting the number of <link>s in the page and automatically creating the "What's New" and "Currently Enjoying" sections. Another feature is a "Search Results" section containing all the links matching keywords extracted from the referer url. This is intended for people who find the page when searching for something that may be on the page.

xmlwebpage.pl

showcount.pl

This script formats and presents the counter results.

showcount.pl

XML Source Files

index.xml

This is the source file for my main page. The xml allows me to use useful tags to delimit the information and I can also include raw html where appropriate.

index.xml

webpage.xml.doc

This document describes the xml tags used by my programs. No DTD is used because XML::Parser ignores it...

webpage.xml.doc

Other details...

.htaccess

This file controls access to the site, and in particular, associates the .xml extension with the CGI.pl script.

.htaccess

tomstyle1.css

This is one of the cascading style sheets used on this site. This simplifies the generated HTML considerably where it works...

tomstyle1.css

test_cgi

This is the first CGI program I wrote (in C++) and it simply echoes the contents of the environment variables. I started writing little classes to encapsulate the CGI and HTML interfaces but kind of gave up when I found perl...

test_cgi ~ test_cgi.cpp ~ HTML.h ~ CGI.h

count.dat

This file stores the hit information for the site. It is basically read into a hash in the perl scripts so stores all sorts of information. The different classes are prefixed with "FILE" and so on to enable the showcount.pl script to do some nicer formatting.

count.dat

Resourses

The following links were found to be useful while learning all this stuff.

Perl and CGI

ActivePerl Help ~ Introduction to Perl & CGI Programming ~ How to set up your Home Page on this server ~ Apache Directives

XML

XML.com