On Wed, 13 Feb 2002, Ryan Parr wrote:

> The code follows:
> sub handler {
>         my $r = shift;
>         return DECLINED unless($r->is_main());
>         # Same behavior when:
>         # return DECLINED unless($r->is_initial_req());
>
>         open TRACK, ">>/usr/local/www/usertracker.txt" or die "Couldn't open
> log: $!";
>         print TRACK
> join("\t",($r->hostname,$r->uri,scalar(localtime))),"\n";
>         close TRACK;
>         return DECLINED;
> }

Hmm, no file locking for something being used by multiple processes?
Could be problematic.  Is print atomic?  Better be sure.

Also, if you just open the filehandle once (not in the handler) this'd
probably be a bit quicker.  And for increased perceived speed have the
writing occur in a cleanup handler.


-dave

/*==================
www.urth.org
we await the New Sun
==================*/

Reply via email to