package Website::AccessLog;
use strict;
use Exporter;
@Website::AccessLog::ISA = qw( Exporter );
@Website::AccessLog::EXPORT_OK= qw( pageview );
$Website::AccessLog::VERSION = 1.02; # 8/10/2002, 1:24:29 PM
=pod
AUTHOR
-Tommy Butler, professional contractor and open source proponent
Atrixnet™, for Internet Business Software®
http://atrixnet.com
6711 Forest Park Dr
Arlington, TX
76001
COPYRIGHT
Copyright Tommy Butler. All rights reserved
LISCENCE
This software is free, and you may use and distribute it under the
GNU GPL liscence. If you modify the code for your own purposes
please acknowledge its original author.
BUGS
Please report any of the following to me
- bugs
- interface inconsistencies
- suggestions
- comments
- complaints
- smart remarks
=cut
# --------------------------------------------------------
# Constructor
# --------------------------------------------------------
sub new { bless({}, __PACKAGE__) }
# --------------------------------------------------------
# Website::AccessLog::OOorNO()
# --------------------------------------------------------
sub OOorNO { $_[0] if (UNIVERSAL::isa($_[0], __PACKAGE__)) }
# --------------------------------------------------------
# AccessLog::pageview
# --------------------------------------------------------
sub pageview {
my($this) = &OOorNO ? shift(@_) : undef;
my($dlm) = qq[\244];
my($elements) =
{
'id' => shift(@_) || time . $$,
'stamp' => shift(@_) || time,
'path' => $ENV{'PATH_INFO'} || '[no path info]',
'remote_ip' => $ENV{'REMOTE_ADDR'} || '[no IP]',
'method' => $ENV{'REQUEST_METHOD'} || '[no request method]',
'requri' => $ENV{'REQUEST_URI'} || '[no requri]',
'referer' => $ENV{'HTTP_REFERER'} || '[no http referer]',
'user_agent' => $ENV{'HTTP_USER_AGENT'} || '[no user agent]',
'lang' => $ENV{'HTTP_ACCEPT_LANGUAGE'} || '[no lang]',
};
{ my($qdlm) = quotemeta($dlm); my($subst) = quotemeta(q[[$$dlm$$]]);
foreach (keys(%{ $elements })) {$elements->{$_} =~ s/$qdlm/$subst/g} }
join
(
$dlm,
(
$elements->{'id'},
$elements->{'stamp'},
$elements->{'remote_ip'},
$elements->{'method'},
$elements->{'requri'},
$elements->{'referer'},
$elements->{'path'},
$elements->{'user_agent'},
$elements->{'lang'},
)
)
}
# --------------------------------------------------------
# Destructor
# --------------------------------------------------------
sub DESTROY {}
1;