#!/usr/bin/perl

print "Content-type: text/html\n\n\n\n";

  ### Get the name of the file being requested.
my $Temp = $ENV{'REQUEST_URI'};
my $Cvs = $Temp;

  ### Split the url by "/".
my (@Junk) = split(/\//, $Cvs);

  ### Get the end of the url, which is the filename.
my $File = pop @Junk;
$Cvs =~ s/[^\/]+$//g;

  ### Attach the document root directory so we get the complete path to the
  ### file on our computer server. Also, attach the CVS/Entries name so that
  ### we get the CVS information.
$Cvs = $ENV{'DOCUMENT_ROOT'} . $Cvs . "CVS/Entries"; 

  ### Open the file, and if we find a match, record it to $Match
my $Match = "";
open(FILE,$Cvs);
while (my $Line = <FILE>) 
  {
  if ($Line =~ /$File/) {$Match = $Line; chomp $Line}
  }
close FILE;

   ### If match is not found, print not found, otherwise get the information.
if ($Match eq "") {print "No CVS information found. '$File'\n";}
else 
  {
     ### Get the information we want and print it out.
  my ($Junk,$File,$Version,$Date,@Junk) = split(/\//, $Match);
  print "Version <b>$Version</b> : Date Last Changed <b>$Date</b>\n";
  }



