I'd look for existing solutions before rolling my own, since calendars are hard to get "just so". How about starting with Tk::Month?
Update for posterity: Don't use Tk::Month. It has limited functionality and doesn't appear to have been maintained in some time. I gave the above advice based on an optimistic appraisal of the module after doing a quick search on CPAN and looking at the docs.
Update: It works fine. Just keep it simple:
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
use Tk::Month;
my $mw = MainWindow->new();
my $month = "November";
my $year = "2006";
my $m = $mw->Month(
-printformat => '%a %e',
-includeall => 0,
-month => $month,
-year => $year,
-command => sub {
my ($ym, $wd) = @_;
my ($month, $year) = split( /\s+/ , $ym );
my ($wday, $date) = split( /\s+/ , $wd->[0] );
print "$wday, $month $date $year\n";
},
);
$m->pack;
MainLoop;
-
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.