| 1 | package HTTP::Request::FromLog::Engine::Default; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use base qw(HTTP::Request::FromLog::Engine::Base); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use Parse::AccessLogEntry; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use HTTP::Headers; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use List::MoreUtils qw(all); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 11 | 1 | my $class = shift; | |||||||||
| 12 | 1 | my %args = @_; | |||||||||
| 13 | |||||||||||
| 14 | 1 | $args{parser} = Parse::AccessLogEntry->new(); | |||||||||
| 15 | |||||||||||
| 16 | 1 | return $class->SUPER::new(%args); | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 2 | ▶ | sub parse { | ||||||||
|
Subroutine
parse: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 20 | 2 | my $self = shift; | |||||||||
| 21 | 2 | my $log_record = shift; | |||||||||
| 22 | |||||||||||
| 23 | 2 | my $record = $self->{parser}->parse($log_record); | |||||||||
| 24 | |||||||||||
| 25 | 2 | ▶ | return undef if all { !defined $_ } values %$record; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||
| 26 | |||||||||||
| 27 | 2 | my $method = $record->{rtype}; | |||||||||
| 28 | 2 | my $uri = $self->{scheme} . '://' . $self->{host} . $record->{file}; | |||||||||
| 29 | 2 | my $header = HTTP::Headers->new(); | |||||||||
| 30 | 2 | $header->header( host => $self->{host} ); | |||||||||
| 31 | 2 | ▶ | $header->header( user_agent => $record->{agent} ) if $record->{agent}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 2 | ▶ | $header->header( referer => $record->{refer} ) if $record->{refer}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | |||||||||||
| 34 | 2 | return ( { method => $method, uri => $uri, header => $header } ); | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 2 | 1; | |||||||||
| 38 | |||||||||||
| 39 | __END__ | ||||||||||