NAME

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

SYNOPSIS

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";

unimport

Allows 'no ApacheLog::Parser' to cleanup your namespace.

parse_line

Assumes an already chomp()'d $line.

my $array_ref = parse_line($line);

parse_line_to_hash

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);

AUTHOR

Eric Wilhelm @ <ewilhelm at cpan dot org>

http://scratchcomputing.com/

BUGS

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

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

NO WARRANTY

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.

LICENSE

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