#!/usr/bin/perl

# Page Last Updated
# Version 1.0
# plu.pl
# By Mike Calabrese
# http://www.mikecalabrese.com
# 09-08-2004

# This program is available for free on an AS-IS basis.  I am not
# responsible for consequential damages, loss of income or whatever
# else that may happen as a result of the use of this program.

print "Content-type: text/html\n\n";
print <<"HTMLDOC";
<HTML><HEAD><TITLE></TITLE></HEAD><BODY bgcolor="#ffffff" text="#000000">
<P>
Updated:
HTMLDOC

# This is the exact UNIX path to this file
$this_file = "$ENV{SCRIPT_FILENAME}";

# This line uses the Perl stat function to grab the epoch date that the
# page was last modified.
$epoch_updated = (stat($this_file))[9];

# This line uses the localtime perl function to set the epoch date to a form
# that we can parse and make proper.
($SECONDS, $MINUTES, $HOURS, $DAY_OF_MONTH, $MONTH,
$YEAR, $WDAY, $YDAY, $ISDST) = localtime($epoch_updated);

# This array converts UNIX number months to proper months.
%propermonth = ('0',January,'1',February,'2',March,'3',
April,'4',May,'5',June,'6',July,'7',August,'8',
September,'9',October,'10',November,'11',December);

# This array converts UNIX number days to proper days.
%properday = ('0',Sunday,'1',Monday,'2',Tuesday,'3',
Wednesday,'4',Thursday,'5',Friday,'6',Saturday);

# This line converts the pre-Y2K year to a proper year.
$YEAR = $YEAR + 1900;

# Change EDT and EST to your time zone if needed.
if ($ISDST eq "1") {
$TZONE = "EDT";
}else{
$TZONE = "EST";
}

# If your server is in a different time zone than you are, change the
# $HOURS variable below appropriately. If it is in the same time zone, just
# comment out this line.
$HOURS = $HOURS + 1;

# This group of 'if' statements places a zero in front of a given hour,
# minute or second if it is less than 10.
if ($HOURS < 10) {
$HOURS = "0$HOURS";
}
if ($MINUTES < 10) {
$MINUTES = "0$MINUTES";
}
if ($SECONDS < 10) {
$SECONDS = "0$SECONDS";
}

# This is the output.
print "$properday{$WDAY}, $propermonth{$MONTH} $DAY_OF_MONTH, $YEAR $HOURS:$MINUTES:$SECONDS $TZONE\n";
print <<"HTMLDOC";
</BODY></HTML>
HTMLDOC
exit;