#!/usr/local/bin/perl chdir("$ENV{HOME}/www"); open(UPD, ">update.htm"); &makehead; open(LSLT, "ls -lt *.htm|"); while () { chomp; @col = split; push @file, $col[8]; $date{$col[8]} = "$col[5] $col[6]"; $col[7] !~ /:/ and $year{$col[8]} = $col[7]; } close(LSLT); foreach (@file) { ($maxlen > length) or $maxlen = length; } $_ = localtime; @col = split; $curmo = $col[1]; $curmo = &month($curmo); $curyr = $col[4]; foreach (@file) { print UPD "\n"; print UPD ' ' x ($maxlen - length), "$_: ", &daypad($date{$_}), ', '; if (exists($year{$_})) { print UPD "$year{$_}"; } else { ( $filemo ) = split /\s+/, $date{$_}; $filemo = &month($filemo); print UPD ( ( $filemo <= $curmo ) ? $curyr : ( $curyr - 1 ) ); } print UPD "\n"; } &makefoot; close(UPD); open(GREP, "grep 'updated' *.htm|"); while () { chomp; @col = split; $_ = "$col[0] $col[5] $col[6]"; ($file, $fdate) = /^([^:]+):This (\w+ \d+)/; if ($fdate ne $date{$file}) { print "File: $file\n", "File Date: $fdate\n", "Actual Date: $date{$file}\n\n"; } } close(GREP); `chmod 0644 update.htm`; exit 0; sub daypad { my($rv) = $_[0]; my($day) = $rv =~ /(\d+)/; if ($day < 10) { $rv =~ s/$day/ $day/; } return $rv; } sub month { $_ = shift; /Jan/ and return 1; $_ == 1 and return "Jan"; /Feb/ and return 2; $_ == 2 and return "Feb"; /Mar/ and return 3; $_ == 3 and return "Mar"; /Apr/ and return 4; $_ == 4 and return "Apr"; /May/ and return 5; $_ == 5 and return "May"; /Jun/ and return 6; $_ == 6 and return "Jun"; /Jul/ and return 7; $_ == 7 and return "Jul"; /Aug/ and return 8; $_ == 8 and return "Aug"; /Sep/ and return 9; $_ == 9 and return "Sep"; /Oct/ and return 10; $_ == 10 and return "Oct"; /Nov/ and return 11; $_ == 11 and return "Nov"; /Dec/ and return 12; $_ == 12 and return "Dec"; } sub makehead { print UPD "Updates\n", "", "
\n", "\"[Construction!]\"\n\n\n", "This page shows the date on which each of my pages was most recently updated.
\n", "Click on any page name to go to that page.
\n", "Please bear in mind that even purely aesthetic changes will cause the page to appear updated.
\n\n
";
}

sub makefoot
{
  print UPD "
\n\n

Return home.

\n\n", "

You can email me at rmharman\@auros.org
\n", "This page is updated on a regular basis via a perl script.

\n\n", "

This page last updated: "; $_ = localtime; @now = split; $_ = "$now[1] $now[2]"; print UPD "$_
\n", "Copyright © 1996-$curyr R Michael Harman

\n\n\n"; }