Go to the documentation of this file.00001 package MMAgic::Log::Parser::Apache::Transfer;
00002 #
00003 # MMAgic/Log/Parser/Apache/Transfer.pm
00004 #
00005 # Parser for normal Apache transfer files.
00006 #
00007
00008 use UNIVERSAL qw(isa);
00009
00010 use MMAgic::Log;
00011 use MMAgic::Log::Parser;
00012 use MMAgic::Trace;
00013
00014 @ISA = qw(MMAgic::Log::Parser);
00015
00016 #!# Log->trace('Loading class ', __PACKAGE__);
00017
00018 ###########################################################################
00019 ###########################################################################
00020 sub parse # $self, $line [, $unrec ]
00021 #
00022 {
00023 my $self = shift;
00024 #!# my $auto = Log->method(@_)->block;
00025 my $line = shift;
00026 my $date = undef;
00027
00028 if ($line =~ /^\s*([^\[\]]*)\s*\[([^\[\]]*)\]\s*(.*)$/)
00029 {
00030 $date = $2;
00031 $line = "$1 $3";
00032
00033 if ($date =~ m|(\d{1,2})/([^/]+)/(\d{2,4}):(\d{1,2}):(\d{1,2}):(\d{1,2})|)
00034 {
00035 # Try to avoid using the Date::Manip functions (they're slow):
00036 $date = $self->makeTime($date, $6, $5, $4, $1, $2, $3);
00037 }
00038
00039 else
00040 {
00041 # Oh, well, better to go for it slowly than not at all:
00042 $date = $self->makeTime($date);
00043 }
00044 }
00045
00046 else
00047 {
00048 if (my $unrec = shift())
00049 {
00050 $unrec->warning
00051 ('Unrecognizable Apache Transfer ', $self->name,
00052 " line:\n ", $line);
00053 }
00054
00055 return $self->SUPER::parse($line, $unrec);
00056 }
00057
00058 # Log->warning('No Apache Transfer date from ', $self->name),
00059 $date = $self->lastDate
00060 unless int($date);
00061
00062 ( $date, 'X', $line )
00063 }
00064
00065 1