line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::LWPish; |
2
|
50
|
|
|
50
|
|
309
|
use strict; |
|
50
|
|
|
|
|
104
|
|
|
50
|
|
|
|
|
1456
|
|
3
|
50
|
|
|
50
|
|
252
|
use warnings; |
|
50
|
|
|
|
|
100
|
|
|
50
|
|
|
|
|
1152
|
|
4
|
50
|
|
|
50
|
|
35962
|
use HTTP::Tiny; |
|
50
|
|
|
|
|
628411
|
|
|
50
|
|
|
|
|
1766
|
|
5
|
50
|
|
|
50
|
|
20791
|
use HTTP::Response; |
|
50
|
|
|
|
|
287027
|
|
|
50
|
|
|
|
|
1579
|
|
6
|
50
|
|
|
50
|
|
4527
|
use Hash::MultiValue; |
|
50
|
|
|
|
|
19023
|
|
|
50
|
|
|
|
|
11962
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
17
|
|
|
17
|
0
|
136
|
my $class = shift; |
10
|
17
|
|
|
|
|
127
|
my $self = bless {}, $class; |
11
|
17
|
50
|
|
|
|
696
|
$self->{http} = @_ == 1 ? $_[0] : HTTP::Tiny->new(@_); |
12
|
17
|
|
|
|
|
3488
|
$self; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub request { |
16
|
89
|
|
|
89
|
0
|
389
|
my($self, $req) = @_; |
17
|
|
|
|
|
|
|
|
18
|
89
|
|
|
|
|
201
|
my @headers; |
19
|
89
|
|
|
107
|
|
604
|
$req->headers->scan(sub { push @headers, @_ }); |
|
107
|
|
|
|
|
3527
|
|
20
|
|
|
|
|
|
|
|
21
|
89
|
|
|
|
|
8253
|
my $options = { |
22
|
|
|
|
|
|
|
headers => Hash::MultiValue->new(@headers)->mixed, |
23
|
|
|
|
|
|
|
}; |
24
|
89
|
100
|
66
|
|
|
7890
|
$options->{content} = $req->content if defined $req->content && length($req->content); |
25
|
|
|
|
|
|
|
|
26
|
89
|
|
|
|
|
3987
|
my $response = $self->{http}->request($req->method, $req->url, $options); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $res = HTTP::Response->new( |
29
|
|
|
|
|
|
|
$response->{status}, |
30
|
|
|
|
|
|
|
$response->{reason}, |
31
|
|
|
|
|
|
|
[ Hash::MultiValue->from_mixed($response->{headers})->flatten ], |
32
|
|
|
|
|
|
|
$response->{content}, |
33
|
89
|
|
|
|
|
39050060
|
); |
34
|
89
|
|
|
|
|
34734
|
$res->request($req); |
35
|
|
|
|
|
|
|
|
36
|
89
|
|
|
|
|
3551
|
return $res; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |