line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Request::FromLog; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1460
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
114
|
|
4
|
3
|
|
|
3
|
|
19
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
90
|
|
5
|
3
|
|
|
3
|
|
3094
|
use HTTP::Request; |
|
3
|
|
|
|
|
101801
|
|
|
3
|
|
|
|
|
99
|
|
6
|
3
|
|
|
3
|
|
2990
|
use UNIVERSAL::require; |
|
3
|
|
|
|
|
8016
|
|
|
3
|
|
|
|
|
36
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
110
|
use 5.8.1; |
|
3
|
|
|
|
|
49
|
|
|
3
|
|
|
|
|
912
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.00002'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
2
|
|
|
2
|
1
|
25709
|
my $class = shift; |
14
|
2
|
|
|
|
|
6
|
my %args = @_; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
7
|
my $self = bless {}, $class; |
17
|
2
|
|
|
|
|
11
|
$self->_init( \%args ); |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
14
|
return $self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _init { |
23
|
2
|
|
|
2
|
|
5
|
my $self = shift; |
24
|
2
|
|
|
|
|
4
|
my $args = shift; |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
100
|
|
|
19
|
my $class = $args->{engine} ||= 'HTTP::Request::FromLog::Engine::Default'; |
27
|
2
|
50
|
|
|
|
17
|
$class->require or die $@; |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
100
|
|
|
10986
|
my $engine_args = $args->{engine_args} ||= {}; |
30
|
2
|
|
50
|
|
|
20
|
$engine_args->{scheme} = $args->{scheme} ||= 'http'; |
31
|
2
|
|
|
|
|
8
|
$engine_args->{host} = $args->{host}; |
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
18
|
$self->{engine} = $class->new(%$engine_args); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub convert { |
38
|
3
|
|
|
3
|
1
|
380
|
my $self = shift; |
39
|
3
|
|
|
|
|
7
|
my $log_record = shift; |
40
|
|
|
|
|
|
|
|
41
|
3
|
|
|
|
|
16
|
my $result = $self->{engine}->parse($log_record); |
42
|
3
|
50
|
|
|
|
243
|
return if ( !defined $result ); |
43
|
|
|
|
|
|
|
|
44
|
3
|
|
|
|
|
25
|
my $request = |
45
|
|
|
|
|
|
|
HTTP::Request->new( $result->{method}, $result->{uri}, |
46
|
|
|
|
|
|
|
$result->{header} ); |
47
|
|
|
|
|
|
|
|
48
|
3
|
|
|
|
|
19014
|
return $request; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |