in reply to Re: Re: CGI counter resets for no obvious reason
in thread CGI counter resets for no obvious reason

Yea, file locking is very important nomatter how unimportant you think it is. I made a really simple counter a couple weeks ago and my friend and I tested it. As soon as we both accessed the counter at the same time the '1' went to a '2.46578837244004' or something like that. I think the counter was along the lines of:
$cfile="counter.txt"; open(COUNT,$cfile); $count=<COUNT>; $count++; close(COUNT); open(COUNT,">$cfile"); print COUNT $count; close(COUNT); print "content-type: text/html\n\n"; print $count;
(pretty confusing at first glance, eh?) Notice that there is no flock in there or any type of locking. Here are some links you should check out.
Simple locking
File locking
flock
Fcntl

Wanna be perl hacker.
Dave AKA damian

I encourage you to email me