Simple Comments: A Basic Perl-Based Comment System for Static Web Pages
A basic, Perl-based comment system for static Web pages
Release date: July 29, 2008
On this page is a collection of information pertaining to WebRef's Simple Comments Perl script that allows you to implement a basic comment posting system on the static pages of your Web site. Here you'll find the latest Simple Comments zipped distribution file, a link to the latest changelog (included in the distribution), basic features and requirements of the system, links to the individual release notes, and whatever else I can think of. To get started with Simple Comments, I recommend that you read this page in its entirety. While not mandatory, the release notes for the versions also provide some potentially helpful bits of information--especially from a developer's perspective--and may be beneficial both from an implementation and an educational perspective, i.e., even if you aren't interested in using the Simple Comments script, you may be interested in reading some of the developmental issues I've encountered while developing it; points that are elaborated upon in the release notes.
The key features and capabilities of the most recent version of Simple Comments include:
- Template-based design: You can craft the HTML output by the scripts by adjusting template files separately from the Perl code.
- Optional Visitor Registration: At the discrection of the administrator, visitors can register on the site and fill in basic information to be displayed on their profile pages. Administrators can force all visitors to register in order to submit comments, elect to simultaneously accept comments from both registered and unregistered visitors, or disable the visitor registration system entirely via configuration parameters. The administrator can also configure the system to force all display names to be unique; in which case visitors can login with their display names, as well (default is to login using their E-mail address).
- OpenID Support: For those implementations that do support visitor registrations, site visitors can login using their OpenIDs. This feature can be enabled or disabled when deploying the script (default is enabled).
- Basic HTML support: A few unadorned HTML tags are
supported in comments; including bold text (<b></b>),
italicized text (<i></i>),
pre-formatted text(<pre></pre>), and links (<a href="blah"></a>). All other HTML tags will be converted to a literal representation. This feature can also be disabled so that no HTML tags are allowed.
- Separate administration: By default, Simple Comments requires that all comments submitted by users must be approved by an administrator before they're displayed on the site; the approval process itself is performed by a separate script from the display script, so it can be snugly tucked behind a password and SSL protected area of your site. You may also configure Simple Comments to allow user submitted comments to be displayed on the site immediately, without requiring administrator approval (but be warned: Simple Comments doesn't perform any automated content filtering on submitted comments). The administration script also allows you to search for and edit existing comments and visitor profiles (if the system is configured to accept visitor registrations).
- Article locking: Articles can be locked (I.E., comment submissions blocked) either automatically based on the age of the article in days, or as needed by the administrator.
- Simple inclusion: Once the system is set up, you can enable comments on a Web page by adding a single Server Side Include directive to the page.
- Comments-per-page option: Support for an administrator-defined number of comments displayed on each page (the display template can include "next" and "previous" links - allows the user to redisplay the selected Web page with the next or previous comments in the list).
- Support for Site Sections: You can configure separate areas of your site to be maintained by separate administrators; each site section can also have its own look and feel.
- Granular Administration Rights: Individual administrators can have separate access rights to the administration script. For example, one administrator might only be able to modify templates, while another can only approve and edit comments.
- Reply to capabilities and threaded displays: You can display your comments via a threaded display, in which replies are displayed beneath the original comment that triggered the reply. Each level of reply receives an identifier so you can apply separate template-based styling to each level of reply.
Support for RSS formatted comment feeds
- Flat File Data Storage: A separate database application setup is unnecessary; approved (published) comments and visitor profiles are stored in XML files.
- Support for
mod_perl: Simple Comments can be run in a
To set up and use this system, you'll need Perl 5.6 or later installed on your server, the Apache Web Server with executable includes enabled (the ability to execute a Perl script when called in the HTML file as an include, see the setup instructions) access rights to create a directory outside the Web server's document root on your server, and access to place scripts into your cgi-bin. Basic Perl savvy and comfort in tossing files around on your Web server (as well as setting their access rights) will also be needed.
Though optional (beginning with .910), access to a password protected area (via Apache access controls) within your cgi-bin is also recommended; preferably reachable via an SSL server.
You will also need the following Perl modules installed on your system:
All but the HTML::Template module are typically installed with your Perl distribution; HTML::Template (and any others that may be missing) you can pick up from CPAN. XML::Simple is sometimes missing; if so, you may need to install both XML::Simple and XML::Parser (which XML::Simple relies on).
The following modules are recommended for use with OpenIDs (i.e., if openid_enabled is set to 1), and may in fact be required for use with some OpenID providers:
To use CAPTCHAs in your comment submission form, you need to decide whether you prefer to use the captchas.net
system (see http://captchas.net)
or the recaptcha system
from Carnegie Mellon University (see
If you select the captchas.net system, then you must first
register with and receive a user-id and shared secret from
http://captchas.net. If you select the recpatcha system,
then register on the http://recaptcha.net site. Registration
for both systems is free as of this writing; though both
request that you warn them if your usage will be somewhat
high (50k+ hits a day for captchas.net, or 100k+ hits a
day for recaptcha.net). Once you've registered, you can
then enable CAPTCHAS by including the appropriate
recaptcha_ parameter settings in the
To enable administrator notifications (the
options) the Web user account (the account used by the
Web server to perform system operations) must have access
to sendmail. Additionally, sendmail access is required to
enable the visitor registration system, since non-OpenID
visitors are required to confirm their E-mail addresses as
part of the registration process.
The comments script will work in both a standard and mod_perl enabled Web server.
Want to submit a test comment? On most pages of our site (including this one) we'll only publish comments that actually pertain to the article, so you can't enter stuff like test comment or hello world. On our Test Page, however, we'll let you get away with those types of comments.
The test page also shows you what the comment display templates look like "out-of-the-box," i.e., the comments are displayed on the test page with the same templates in the Simple Comments distribution file (for the comments that appear on other pages of our site, we've modified the templates to match the WebRef look and feel). You can access the test page by clicking on the following link:
You can download the latest version of Simple Comments by clicking this link: comments.zip. The download is provided as a zipped file; use your favorite extractor to unzip it.
To view a list of changes from version to version, read the CHANGES.txt file.
Refer to the
Readme.txt, included in the
Zip distribution, for setup instructions.
These articles contain notes pertaining to each individual release of Simple Comments. Developers who are learning Perl may find these release notes of interest. The first release article (v.902) includes much of the information on this page, and also discusses the basic architecture of the scripts. Later release articles focus on new features, documentation of fixed bugs, and/or technical points of interest within the new release itself.
- v.960 (July 14, 2008)
- v.950 (November 14, 2007)
- v.930 (April 27, 2007)
- v.920 (December 26, 2006)
- v.910 (September 13, 2006)
- v.902 (July 5, 2006)
Created: September 13, 2006
Revised: August 1, 2008