in reply to Count how many times a CGI script has been called

Alaso remember that your CGI script will be called many times, perhaps even (almost) simultaneously and that if you go for the "open data-file and add one to a value in this file", you are opening yourself to various race-conditions (such as: script instance A opens datafile and reads value; meanwhile instance B of the same script does likewise; instance A increments value and writes it back to the file; instance B does the same. Result: only 1 is added to the counter and not 2.)

And we are not even considering the bad things which can happen when your data-file gets opened simultaneously multiple times for reading and writing. This could confuse the best of Operating Systems!

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

  • Comment on Re: Count how many times a CGI script has been called