All good points. This code is only to test mod_perl Perl*Handler mechanisms
to ensure that I can get the proper log. Once I figure out the necessary
routines to do this then I'll integrate it with the rest of my mod, which
logs request and session info to a database.

-- Ryan

----- Original Message -----
From: "Dave Rolsky" <[EMAIL PROTECTED]>
To: "Ryan Parr" <[EMAIL PROTECTED]>
Cc: "mod_perl list" <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 4:23 PM
Subject: Re: Custom Logging and User Tracking


> 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