PerlHoo, Part III | 3 | WebReference

PerlHoo, Part III | 3

PerlHoo, Part III

Magic and Grease

Too bad managing a system isn't as magical as solving a complex problem with an elegant solution. Well, writing the management tools aren't too glittery either. In fact, they're usually down-right tedious. Fortunately, I'd already finished Half-Life a couple months ago and am still waiting for Quake III, so I had a bit more time to write phadmin.pl than I did for perlhoo.pl.

With any management software you write, you first have to figure out what you've got to work with. Since PerlHoo uses file system directories to represent categories and the data is stored in files, I knew the magic would be recursion, but I'd forgotten how much grease would be required to deal with the CSV files that contain the entries.

Directory File Format

First, let's look at one of the CSV files:
http://www.Internet.com,Internet.com,"Jupitermedia Corp.","Jonathan Eisenzopf",eisen@pobox.com
http://www.news.com,"CNet News","The CNet News Channel","Jonathan Eisenzopf",eisen@pobox.com

There are five columns in the PerlHoo files:

  1. URL
  2. Title
  3. Description
  4. Submitter Name
  5. Submitter Email
As in perlhoo.pl, we'll be using the Text::CSV_XS module to manipulate the CSV data files. If you recall, the original reasoning for using CSV files was to allow a non-technical person to maintain the directory using a text editor, word processor, or spreadsheet.

Submission Process

In Part II, we added the ability for users to submit new sites to the directory. Rather than being written to the production file, the new entries were written to the new_perlhoo.csv file. The idea was that an editor would review the file from time to time and choose which entries to move into the production file. Of course, this could get tedious real quick. Check out http://www.webreference.com/cgi-bin/perl/3/perlhoo.pl to experiment with this feature.


http://www.internet.com

Produced by Jonathan Eisenzopf and
Created: July 1, 1999
Revised: July 2, 1999

URL: http://www.webreference.com/perl/tutorial/5/