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 > 2001 > 10 > Programming with Perl  

Rendering Calendars in HTML

By Randal L. Schwartz

I keep a text-file link from my home page that shows all of the places that my crazy conference and training schedule takes me. Each entry is a single line showing a date range in day-month-year format, followed by a short phrase, and possibly a URL for further information.

For a long time, I've been meaning to move these public schedule items out of a flat file and into a real database. Then I could have them display as a nice HTML table calendar, with a link from my page. The convenience of just editing the flat file kept me from getting around to it until it occurred to me that I could keep my flat-file data source, and merely interpret the data as it was.

I whipped out the documentation for Date::Manip (from the CPAN) and figured out the correct date format with which I could compute date ranges. I then wrote a regular expression or two to pick up the date range pieces and feed them to the Date::Manip routines for computation. Within a short time, I had a program that output the text of each activity, preceded by every date connected to that item. Cool.

Next I had to render it in a nice HTML table. Bleh. I hated the thought of even more date calculations and HTML wrangling, even though Date::Manip can do just about everything. Luckily, I recalled stuffing away a note to look at HTML::CalendarMonthSimple, and sure enough, this module was exactly the ticket.

But after hooking together the date-extraction logic with the HTML rendering logic, I discovered that my poor little ISP's shared Web server was getting nailed each time I tweaked the HTML color settings and hit reload.




  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