The WFOLPWC was written on Linux. Other platforms may or may not be able to use this, your guess is probably better than mine.
perl -e 'print "Content-Type = text/html\n\n";open(F, "counter.dat");w +hile (<F>) {$c = $_};chomp $c;$c++;print "$c\n";close F;unlink "count +er.dat";open(N, ">counter.dat");print N "$c";'
And since code tags make copying and pasting one-liners less than ideal:
perl -e 'print "Content-Type = text/html\n\n";open(F, "counter.dat");while (<F>) {$c = $_};chomp $c;$c++;print "$c\n";close F;unlink "counter.dat";open(N, ">counter.dat");print N "$c";'
And for the anally retentive file locking crowd: (Code changes by wog)
perl -MCGI -MFcntl=:flock,:seek -e'print CGI->new->header;open F,"+<counter.dat";flock F,LOCK_EX;print $b=<F>;seek ,0,SEEK_SET;print F ++$b;'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: One-Line Web Counter
by Zaxo (Archbishop) on Sep 09, 2001 at 06:55 UTC | |
|
(zdog) Re: One-Line Web Counter
by zdog (Priest) on Sep 09, 2001 at 07:02 UTC | |
by jj808 (Hermit) on Sep 09, 2001 at 16:36 UTC | |
by tilly (Archbishop) on Sep 09, 2001 at 21:21 UTC | |
|
Re: One-Line Web Counter
by merlyn (Sage) on Sep 10, 2001 at 05:38 UTC | |
by shotgunefx (Parson) on Sep 10, 2001 at 13:23 UTC | |
by tilly (Archbishop) on Sep 10, 2001 at 16:25 UTC | |
by shotgunefx (Parson) on Sep 10, 2001 at 16:55 UTC | |
by $code or die (Deacon) on Sep 10, 2001 at 17:25 UTC | |
by jj808 (Hermit) on Sep 10, 2001 at 18:14 UTC | |
|