Here are a couple of others.
#!/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
#!/usr/bin/perl -w
use strict;
use CGI;
use Calendar::Simple;
# HTML::CalendarMonthSimple seems even better suited
# HTML::CalendarMonthSimple is a Perl module for
# generating, manipulating, and printing a HTML calendar
# grid for a specified month. It is intended as a faster
# and easier-to-use alternative to HTML::CalendarMonth."
my $rqry = new CGI();
print CGI::header();
my @months = qw(January February March April May June July
August September October November December);
my $mon = shift || (localtime)[4] + 1;
my $yr = shift || ((localtime)[5] + 1900);
my @month = calendar($mon, $yr);
print '<html><body>';
print "$months[$mon -1] $yr\n\n";
print '<table>';
print '<tr><td>Su</td> <td>Mo</td> <td>Tu</td> <td>We</td>'
.'<td>Th</td> <td>Fr</td> <td>Sa</td></tr></tr>';
foreach (@month) {
print '<tr>';
print map{"<td>$_</td>"} @$_;
print '</tr>';
}
print "</table>";
print "<pre>// or with pre-tag:\n";
print "$months[$mon -1] $yr\n";
print "Su Mo Tu We Th Fr Sa\n";
foreach (@month) {
print map { $_ ? sprintf("%2d ", $_) : ' ' } @$_;
print "\n";
}
print '</pre></body></html>';
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.