I needed a calendar in outline form in order to keep track of my day to day
accomplishments. I implemented it as a Perl program that takes the year on
the command line, and spits out the calendar via stdout, which can be
redirected to a file.
I then incorporated it into my menu system (UMENU) with a script, so now all I
do is choose "Make calendar outline for this year", and if no outline exists,
it creates one, otherwise it issues an error message rather than write over
an existing calendar outline.
I think the VimOutliner crew already has stuff way beyond this simple script,
so I'm copying them also.
Below my sig is the script.
#Copyright (C) 2005 by Steve Litt, all rights reserved.
#Licensed under version 2 of the GNU General Public License.
# GLOBAL DATA
my $secondsPerDay = 60*60*24;
my @monthnames = ('Zero', 'January', 'February', 'March', 'April',
'May', 'June', 'July', 'August', 'September', 'October',
my @daynames = ('Sunday', 'Monday', 'Tuesday', 'Wednesday',
'Thursday', 'Friday', 'Saturday');
# PROGRAM LOGIC
# HANDLE YEAR ARGUMENT, CONVERT TO SECONDS SINCE EPOCH
my $calYear = shift(@ARGV);
print STDERR "makecal must have one argument, the year\n";
print STDERR "usage makecal year\n";
my $time = timelocal(0,0,0,1,0,$calYear);
# INITIALIZE struct_tm
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
$mon++; # Make it 1 based instead of zero based
$year += 1900; # Make 4 digit y2k compliant
# INITIALIZE BREAK LOGIC
my $hold_mday = 9999;
my $hold_mon = 0;
my $hold_year = $year;
# LOOP THROUGH DAYS OF YEAR
while($year == $hold_year)
# BREAK LOGIC
if($mon > $hold_mon) # new month
printf("%s %4d\n", $monthnames[$mon], $year);
elsif($wday == 1)
# PRINT THE DAY'S LINE
$mon, $mday, $year, $daynames[$wday]);
# HOLD VALUES FOR NEXT ITERATION'S BREAK LOGIC
$hold_year = $year;
$hold_mday = $mday;
$hold_mon = $mon;