NAME
CGI::WPM::Usage - Perl module that is a subclass of CGI::WPM::Base and tracks site usage details, as well as e-mail backups of usage counts to the site owner.
DEPENDENCIES
Perl Version
5.004
Standard Modules
I<none>
Nonstandard Modules
CGI::WPM::Base 0.31
CGI::WPM::Globals 0.3
CGI::EventCountFile 1.01
SYNOPSIS
require CGI::WPM::Globals;
my $globals = CGI::WPM::Globals->new( "/path/to/site/files" ); # get input
if( $globals->user_input_param( 'debugging' ) eq 'on' ) {
$globals->is_debug( 1 ); # let us keep separate logs when debugging
}
$globals->site_title( 'Sample Web Site' ); # use this in e-mail subjects
$globals->site_owner_name( 'Darren Duncan' ); # send reports to him
$globals->site_owner_email( 'darren@sampleweb.net' ); # send reports here
require CGI::WPM::Usage;
$globals->move_current_srp( $globals->is_debug() ? 'usage_debug' : 'usage' );
$globals->move_site_prefs( '../usage_prefs.pl' ); # configuration file
CGI::WPM::Usage->execute( $globals ); # do all the work
$globals->restore_site_prefs();
$globals->restore_last_srp();
$globals->send_to_user(); # send output
Content of Configuration File "usage_prefs.pl"
my $rh_preferences = {
email_logs => 1, # do we want to be sent daily reports?
fn_dcm => 'date_counts_mailed.txt', # our lock file to track mailings
mailing => [ # keep different types of reports in own emails
{
filenames => 'env.txt',
subject_unique => ' -- usage (env) to ',
}, {
filenames => 'site_vrp.txt',
subject_unique => ' -- usage (page views) to ',
}, {
filenames => 'redirect_urls.txt',
subject_unique => ' -- usage (external) to ',
}, {
filenames => [qw(
ref_urls.txt ref_se_urls.txt
ref_se_keywords.txt ref_discards.txt
)],
subject_unique => ' -- usage (references) to ',
erase_files => 1, # start over listing each day
},
],
env => { # what misc info do we want to know (low value distrib)
filename => 'env.txt',
var_list => [qw(
DOCUMENT_ROOT GATEWAY_INTERFACE HTTP_CONNECTION HTTP_HOST
REQUEST_METHOD SCRIPT_FILENAME SCRIPT_NAME SERVER_ADMIN
SERVER_NAME SERVER_PORT SERVER_PROTOCOL SERVER_SOFTWARE
)],
},
site => { # which pages on our own site are viewed?
filename => 'site_vrp.txt',
},
redirect => { # which of our external links are followed?
filename => 'redirect_urls.txt',
},
referrer => { # what sites are referring to us?
filename => 'ref_urls.txt', # normal websites go here
fn_search => 'ref_se_urls.txt', # search engines go here
fn_keywords => 'ref_se_keywords.txt', # their keywords go here
fn_discards => 'ref_discards.txt', # uris we filter out
site_urls => [qw( # which urls we want to count as self-reference
http://www.sampleweb.net
http://sampleweb.net
http://www.sampleweb.net/default.pl
http://sampleweb.net/default.pl
http://www.sampleweb.net:80
http://sampleweb.net:80
http://www.sampleweb.net:80/default.pl
http://sampleweb.net:80/default.pl
)],
discards => [qw( # filter uri's we want to ignore
^(?!http://)
deja
mail
)],
use_def_engines => 1, # use info on some engines that class holds
search_engines => { # match domain with query param holding keywords
superfind => 'query',
getitnow => 'qt',
'gimme.com' => 'iwant',
},
},
};
DESCRIPTION
This POD is coming when I get the time to write it.
SYNTAX
This class does not export any functions or methods, so you need to call them using indirect notation. This means using Class->function() for functions and $object->method() for methods.
PUBLIC FUNCTIONS AND METHODS
This module inherits its entire public interface from CGI::WPM::Base. Please see the POD for that module so you know how to call this one.
PREFERENCES HANDLED BY THIS MODULE
This POD is coming when I get the time to write it. Meanwhile, the Synopsis uses the most important ones. Most of them are optional.
AUTHOR
Copyright (c) 1999-2000, Darren R. Duncan. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. However, I do request that this copyright information remain attached to the file. If you modify this module and redistribute a changed version then please attach a note listing the modifications.
I am always interested in knowing how my work helps others, so if you put this module to use in any of your own code then please send me the URL. Also, if you make modifications to the module because it doesn't work the way you need, please send me a copy so that I can roll desirable changes into the main release.
Address comments, suggestions, and bug reports to perl@DarrenDuncan.net.
SEE ALSO
perl(1), CGI::WPM::Base, CGI::WPM::Globals, CGI::EventCountFile.