
ApacheLog::Parser - parse apache 'combined' log format

use ApacheLog::Parser qw(parse_line);
# imports the field constants too
my %visitors;
while(my $line = <$fh>) {
chomp($line);
my $ref = parse_line($line);
($visitors{$ref->[client]} ||= 0)++;
}
no ApacheLog::Parser; # cleans-out the constants
print join("\n ", 'visitors:',
map({$_ . ': ' . $visitors{$_}} keys(%visitors))), "\n";
Allows 'no ApacheLog::Parser' to cleanup your namespace.
Assumes an already chomp()'d $line.
my $array_ref = parse_line($line);
Is a little more elegant interface than the array-ref and constants used in parse_line(), but you pay dearly for passing-around those hash keys. Fun for one-off stuff, but not recommended for heavy lifting.
my %hash = parse_line_to_hash($line);

Eric Wilhelm @ <ewilhelm at cpan dot org>

If you found this module on CPAN, please report any bugs or feature requests through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
If you pulled this development version from my /svn/, please contact me directly.

Copyright (C) 2007 Eric L. Wilhelm, All Rights Reserved.

Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In case of loss, no person or entity owes you anything whatsoever. You have been warned.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.