|Come for the quick hacks, stay for the epiphanies.
Web month Calanderby Ryszard (Priest)
|on Nov 22, 2001 at 14:26 UTC
Ryszard has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a web based calander, and want to display a month (or more) in a html table, add links and pull out whatever data is associated with the link (ala the yahoo datebook).
Now i've got it printing out a nice little table with all the dates in the correct spots etc, (which is good) but i'm iterating thru' three loops. one to pull out the days, one to build a monthly matrix (much like the `cal` command), and the final loop builds the html.
I'm thinking this is pretty slow and inefficient, and was wondering if there is a better way.
I thought of using a hash for the number of days in a month (and making the appropriate exceptions for a LY, then determining what day is the 1st of the month) however i'm still stuck with two loops.
Naturally any comments on the style of the code appreciated.