magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 1997 > 08 > Programming with Perl  

Chatting Up CGI.pm

Web-chat scripts resemble Internet Relay Chat, but with far fewer bells and whistles: Several people go to a particular URL at the same time, type messages into a form field, press Submit, and then get to see what the others said at the same time. Kind of like a really fast-moving guest book that keeps only the 32 most recent entries. Some people are into this.

I, as you well know, am into the all-singing, all-dancing, gotta-have-it CGI.pm module -- always looking for ways to show off its fantastic features. Take its save method, for example, which allows you to save structured data into a flat text file to be processed later. To demonstrate this feature and illustrate how to flock() a datafile and generate HTML on the fly, I've hacked out a little Web-chat script. Stick it somewhere, and you can talk with a friend, or make friends.

Let me state up front, however, that this script is not meant to be used as-is. It merely illustrates some technology around the CGI.pm module, saving and restoring queries, and how to use flock().

The Program

Listing One presents my little toy Web-chat script. Lines 1 and 2 enable taint checks, warnings, and appropriate compiler and runtime restrictions. Line 4 pulls in the CGI.pm module, and defines the standard useful set of form-access and HTML-generation methods.<>




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2