Why not adopt me?
NAME
Webalizer::Hist - Perl module to parse the webalizer.hist-file.
VERSION
This document describes version 0.02 of Webalizer::Hist, released 2006-02-19.
SYNOPSIS
use Webalizer::Hist;
if(my $dwh = Webalizer::Hist->new(source => "webalizer.hist")) {
while(my $hashref = $dwh->month()) {
print "Got " . $hashref->{totalhits} . " hits in month "
. $hashref->{month} . "\n";
}
if(my $totals = $dwh->totals()) {
print "This website used a total of " . $totals->{kbytes}
. "KB\n";
}
}
DESCRIPTION
Webalizer - a popular web server log analysis program - uses a so-called webalizer.hist file to store (temporary) statistics. That file usually contains one year of monthly statistics about a website/webserver.
Webalizer::Hist can be used read and parse those data.
METHOS
The following methods can be used:
new
Creates a new Webalizer::Hist object using the configuration passed to it in key/value-pairs. new returns zero or undef on error.
options
The following options can be passed to new:
- source
-
This option is required, specifies the source of the webalizer.hist-data to be parsed. Can either be a scalar containing a filename or a scalarref to the actual data.
- desc
-
Optional, specifies the order in which the
monthmethod should return the data. Set to undef or zero to sort on the date in ascending order, (newest month last) or set to a positive value to sort in descending order, (newest month first) which is the default.
month( [month] )
Returns a hashref containing the data for the month specified by the optional argument month (a number between 1 and 12), or the next month in de list. (The order is specified by the desc-option to new).
The hashref contains the following keys:
month year firstday lastday totalhits totalfiles
totalsites totalkbytes totalpages totalvisits
avghits avgfiles avgsites avgkbytes avgpages avgvisits
Most keys are self-explainable, month and year specifies the month and the year of the data returned, and firstday and lastday specify the beginning and ending of the month (in days). The total* keys give the total of the month, and the avg* keys the daily average.
totals
Returns a hashref containing the sum of the statistics for all months found in the webalizer file. The hashref contains the following keys:
hits files sites kbytes pages visits
SEE ALSO
Website of Webalizer::Hist: http://dev.yorhel.nl/Webalizer-Hist/,
Website of The Webalizer: http://www.mrunix.net/webalizer/.
BUGS
No known bugs, but that doesn't mean there aren't any. If you find a bug please report it at http://rt.cpan.org/Public/Dist/Display.html?Name=Data::Webalizer::Hist or contact the author.
AUTHOR
Y. Heling, <yorhel@cpan.org>, (http://www.yorhel.nl/)
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Y. Heling
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.