Hi,
I've got Apache running fine on a Win XP machine & all my static pages are
working fine. The CGI test pages work ok, but I cant seem to get a web
counter to work:
I've got a test shtml page "countertest.shtml" that looks like this:
<html>
<head>
<title>Basic Hit Counter Example</title>
</head>
<body>
<br>
<br>
<br>
<p>You are person number
<!--#include virtual="/cgi-bin/counter.pl" -->
to view this demo!</p>
</body>
</html>
counter.pl is indeed in the /cgi-bin directory & looks like this:
#!\indigoperl\bin\perl
# the path for the log file
$logpath = "count.dat";
# digits for the counter
$pad = 5;
# opens the log file for reading, will be created if none exists.
open (LOG, "$logpath");
@file = <LOG> # an array of the file contents
close(LOG);
$count = $file[0]; # the count value is the first line in the file, i.e.
$file[0]
$count++; # increments the counter value
open (LOG, ">$logpath"); # opens the log file for writing
flock(LOG, 2); # file lock set
print LOG "$count\n"; # prints out the new counter value to the file
flock(LOG,

; # file lock unset
close(LOG);
# sets the leading zeros padding for the counter
$pad = "%.$pad"."d";
$count = sprintf($pad, $count);
# prints out the counter
print "Content-type: text/html\n\n";
print "$count";
The web page gives:
You are person number [an error occurred while processing this directive] to
view this demo!
count.dat isn't created & the error log tells me:
unable to include "/cgi-bin/counter.pl" in parsed file
c:/indigoperl/htdocs/countertest.shtml
This is my first attempt at CGI & am at a loss, I'm sure I doing something
daft, any help much appreciated.
TIA
--
oOo
Andy Stevenson
http://home.freeuk.net/stevenso/
"A little bit of pain never hurt anyone!" Sam, aged 11