| 1 | package HTTP::Request::FromLog; | ||||||||||||
| 2 | |||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 4 | ▶ | use HTTP::Request; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 4 | ▶ | use UNIVERSAL::require; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 4 | ▶ | use 5.8.1; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 4 | our $VERSION = '0.00002'; | |||||||||||
| 11 | |||||||||||||
| 12 | 2 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 13 | 2 | my $class = shift; | |||||||||||
| 14 | 2 | my %args = @_; | |||||||||||
| 15 | |||||||||||||
| 16 | 2 | my $self = bless {}, $class; | |||||||||||
| 17 | 2 | $self->_init( \%args ); | |||||||||||
| 18 | |||||||||||||
| 19 | 2 | return $self; | |||||||||||
| 20 | } | ||||||||||||
| 21 | |||||||||||||
| 22 | 2 | ▶ | sub _init { | ||||||||||
|
Subroutine
_init: called CC=5 SCAR=16.2
| |||||||||||||
| 23 | 2 | my $self = shift; | |||||||||||
| 24 | 2 | my $args = shift; | |||||||||||
| 25 | |||||||||||||
| 26 | 2 | ▶ | my $class = $args->{engine} ||= 'HTTP::Request::FromLog::Engine::Default'; | ||||||||||
|
Condition100%2/2
$args->{"engine"} ||= "HTTP::Request::FromLog::Engine::Default"
MC/DC100%1/1
$args->{"engine"} ||= "HTTP::Request::FromLog::Engine::Default"
$args->{"engine"}
Truth table100%2/2
A
A= $args->{"engine"}
| |||||||||||||
| 27 | 2 | ▶ | $class->require or die $@; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 28 | |||||||||||||
| 29 | 2 | ▶ | my $engine_args = $args->{engine_args} ||= {}; | ||||||||||
|
Condition100%2/2
$args->{"engine_args"} ||= {}
MC/DC100%1/1
$args->{"engine_args"} ||= {}
$args->{"engine_args"}
Truth table100%2/2
A
A= $args->{"engine_args"}
| |||||||||||||
| 30 | 2 | ▶ | $engine_args->{scheme} = $args->{scheme} ||= 'http'; | ||||||||||
|
Condition50%1/2
$args->{"scheme"} ||= "http"
MC/DC0%0/1
$args->{"scheme"} ||= "http"
$args->{"scheme"}
Truth table50%1/2
A
A= $args->{"scheme"}
| |||||||||||||
| 31 | 2 | $engine_args->{host} = $args->{host}; | |||||||||||
| 32 | |||||||||||||
| 33 | 2 | $self->{engine} = $class->new(%$engine_args); | |||||||||||
| 34 | |||||||||||||
| 35 | } | ||||||||||||
| 36 | |||||||||||||
| 37 | 3 | ▶ | sub convert { | ||||||||||
|
Subroutine
convert: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||
| 38 | 3 | my $self = shift; | |||||||||||
| 39 | 3 | my $log_record = shift; | |||||||||||
| 40 | |||||||||||||
| 41 | 3 | my $result = $self->{engine}->parse($log_record); | |||||||||||
| 42 | 3 | ▶ | return if ( !defined $result ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 43 | |||||||||||||
| 44 | my $request = | ||||||||||||
| 45 | HTTP::Request->new( $result->{method}, $result->{uri}, | ||||||||||||
| 46 | 3 | $result->{header} ); | |||||||||||
| 47 | |||||||||||||
| 48 | 3 | return $request; | |||||||||||
| 49 | } | ||||||||||||
| 50 | |||||||||||||
| 51 | 4 | 1; | |||||||||||
| 52 | |||||||||||||
| 53 | __END__ | ||||||||||||