#!/usr/bin/perl -w
#
# this script updates the "Last update on..." in a web page
#
# written by:   Maciej Kalisiak <mac@dgp.utoronto.ca>
#
# latest version and info:
#     http://www.eecg.utoronto.ca/~mac/projects/sendwebpages.html
#

#######
# you might want to customize some of these
#
#    home_addr:  the web address of your main/root web page
#    email_addr: your email address
#    my_name:    your full name
#    font_size:  size of font to use for the footer
#
$home_addr="http://www.eecg.utoronto.ca/~mac";
$email_addr='mac@dgp.utoronto.ca';
$my_name="Maciej Kalisiak";
$font_size="-1";
$date=`date`;

die "need a filename" if( @ARGV != 1 );
$file=shift;
die "not an HTML file?" if( not $file =~ /\.html/i );
open FILE, $file or die "unable to open file";
@_ = <FILE>;
$_ = "@_";
close FILE;

# generate the new blurb
$blurb = <<END_OF_BLURB;
<!-- date stamp: begin -->
  <p><hr>
  <table width="100%"><tr><td align=left>
  <font size=$font_size>
  Last modified on: $date
  </font>
  <td align=center>
  <font size=$font_size>
  <a href=\"$home_addr\">HOME</a>
  </font>
  <td align=right>
  <font size=$font_size>
  $my_name &lt<a href=\"mailto:$email_addr\">$email_addr</a>&gt
  </font>
  </tr></table>
  <!-- date stamp: end -->
END_OF_BLURB
  
# replace blurb
s/<!-- date stamp: begin .* date stamp: end -->\n/$blurb/s;

open FILE, ">$file" or die "unable to open file for writing";
print FILE;
