#!/usr/local/bin/perl -- use strict; # Roman Numeral Counter, Version 1.0.0.0003 # Copyright 1997-2001 by Zoltan Milosevic. Please adhere # to the copyright notice and conditions of use which are described # in the attached help file and hosted at the URL below. # # For latest version and help files, visit: # http://www.xav.com/scripts/roman/ # __________________________________________________________________ # Instructions: # ------------- # Below, in the $directory variable, write in the path to a writable # directory on your system: my $directory = 'data'; # Make this directory writable by typing "chmod 777 data". # # Include the following in your web pages: # # You are visitor number . # # _____________________________________________________________________ print "Content-Type: text/html\015\012\015\012"; my $err = ''; Err: { unless (chdir($directory)) { $err = "unable to chdir to \$directory folder '$directory' - $!"; next Err; } unless ($ENV{'DOCUMENT_URI'}) { $err = "environment variable DOCUMENT_URI is not defined (script must be called as SSI)"; next Err; } my $Document = $ENV{'DOCUMENT_URI'}; $Document =~ s/\//_/g; my $Hits = 0; if (-e $Document) { unless (open(FILE,"<$Document")) { $err = "unable to read file '$Document' - $!"; next Err; } $Hits = ; close(FILE); #print "\n"; } else { #print "\n"; } $Hits++; unless (open(FILE, ">$Document")) { $err = "unable to open file '$Document' for writing - $!"; next Err; } print FILE $Hits; close(FILE); #print "\n"; my ($Ones,$Tens,$Hundreds) = split(//, reverse $Hits); print 'M' x int($Hits/1000); print (('','C','CC','CCC','CD','D','DC','DCC','DCCC','CM')[$Hundreds]); print (('','X','XX','XXX','XL','L','LX','LXX','LXXX','XC')[$Tens]); print (('','I','II','III','IV','V','VI','VII','VIII','IX')[$Ones]); last Err; } continue { print "

Roman TextCounter Error: $err.

\n"; }