in reply to CGI counter resets for no obvious reason

I can't see the actual mistake, but here are some things you should always do and maybe that even fixes your problem:
If that doesn't help at all review your flush/flock code. I never lock counter files and it always works fine, so I don't thinks it's neccessary..
Regards, octopus

Replies are listed 'Best First'.
Re: Re: CGI counter resets for no obvious reason
by extremely (Priest) on Jan 30, 2001 at 21:04 UTC
    I never lock counter files and it always works fine, so I don't thinks it's neccessary.. *boggle*

    Personally, I never lock my house door and my stuff is always there when I get back so I don't think doors are necessary.

    Updated I didn't intend this to be mean but seriously, people haven't invented multiple ways to file lock just out of sheer boredom or for the excitement of it.

    --
    $you = new YOU;
    honk() if $you->love(perl)

      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
      okok, I correct myself: For my special purpose(s) filelocking wasn't necessary. Everybody who wants to write serious counter-applications (not just for fun) should lock his/her files and make backups every now and then..

      octopus
      --
      GED/CC d-- s:- a--- C++(+++) UL+++ P++++$ L++>++++ E--- W+++@ N o? K? w-- O- M-(+) V? !PS !PE !Y PGP+(++) t-- 5 X+ R+(+++) tv+(++) b++@ DI+() D+ G++ e->+++ h!++ r+(++) y+