| 1 | package HTTP::Engine::Role::RequestBuilder::Standard; | ||||||||||
| 2 | 56 | ▶ | use Any::Moose '::Role'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 56 | ▶ | use Socket qw[AF_INET inet_aton]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 56 | with qw(HTTP::Engine::Role::RequestBuilder); | |||||||||
| 7 | 56 | ▶ | use CGI::Simple::Cookie (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 2 | ▶ | sub _build_cookies { | ||||||||
|
Subroutine
_build_cookies: called CC=2 SCAR=6.9
| |||||||||||
| 10 | 2 | my($self, $req) = @_; | |||||||||
| 11 | |||||||||||
| 12 | 2 | ▶ | if (my $header = $req->header('Cookie')) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | 1 | return { CGI::Simple::Cookie->parse($header) }; | |||||||||
| 14 | } else { | ||||||||||
| 15 | 1 | return {}; | |||||||||
| 16 | } | ||||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 1 | ▶ | sub _build_hostname { | ||||||||
|
Subroutine
_build_hostname: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 1 | my ( $self, $req ) = @_; | |||||||||
| 21 | 1 | gethostbyaddr( inet_aton( $req->address ), AF_INET ); | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | # for win32 hacks | ||||||||||
| 25 | 56 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=10.8
| |||||||||||
| 26 | 56 | ▶ | if ($^O eq 'MSWin32') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 56 | ▶ | no warnings 'redefine'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 0 | ▶ | *_build_hostname = sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 29 | 0 | my ( $self, $req ) = @_; | |||||||||
| 30 | 0 | my $address = $req->address; | |||||||||
| 31 | 0 | ▶ | return 'localhost' if $address eq '127.0.0.1'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | return gethostbyaddr( inet_aton( $address ), AF_INET ); | |||||||||
| 33 | 0 | }; | |||||||||
| 34 | } | ||||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 56 | 1; | |||||||||