For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > March 2005 > calendar









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author calendar
Octavian Rasnita

2005-03-26, 8:56 am

Hi,

Can you recommend a good module for creating calendars with links for each
day in html format?

I have searched with CPAN after "calendar" and I found more modules, but I
don't know which one would be the best.

Have you used one that's good?

Thanks.

Teddy

Zentara

2005-03-26, 3:55 pm

On Sat, 26 Mar 2005 13:07:50 +0200, orasnita@fcc.ro (Octavian Rasnita)
wrote:

>Hi,
>
>Can you recommend a good module for creating calendars with links for each
>day in html format?
>
>I have searched with CPAN after "calendar" and I found more modules, but I
>don't know which one would be the best.
>
>Have you used one that's good?


#!/usr/bin/perl
use CGI qw(header);
use HTML::CalendarMonthSimple;
use strict;

my %cal;

while (<DATA> ) {
chomp;
my ($file,$yyyy,$mm,$dd) = /([^.]+)\.(\d{4})(\d\d)(\d\d)/;
push @{$cal{$yyyy}->{$mm}},{day => $dd, targ => $file};
}

print header;

for my $year (sort keys %cal) {
for my $mon (sort keys %{$cal{$year}}) {
my $cal = HTML::CalendarMonthSimple->new(
month => $mon,
year => $year,
);
for (sort @{$cal{$year}->{$mon}}) {
$cal->setdatehref(int($_->{day}), $_->{targ});
}
print $cal->as_HTML();
}
}

__DATA__
file5.20030227
file2.20020802
file1.20020801
file4.20021015
file3.20020803
__END__

--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com