Engine/Role/RequestBuilder/Standard.pm

filter: Statementstmt 80.7% 21 / 26 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod n/a totaltotal 77.5% 31 / 40 CC 4 SCAR 8.9
CC
4
Cov
75%
__ANON__
6.0
BEGIN
2.9
_build_cookies
2.0
CRAP 2.4
« Engine/Role/Interface.pm ↑ Summary Engine/Role/Request.pm »
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
BranchTrueFalseTotal
if (my $header = $req->header('Cookie')) { } 1 1 2
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
BranchTrueFalseTotal
if ($^O eq "MSWin32") 0 56 56
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
BranchTrueFalseTotal
if $address eq "127.0.0.1" 0 0 0
32 0 return gethostbyaddr( inet_aton( $address ), AF_INET );
33 0 };
34 }
35 }
36  
37 56 1;
« Engine/Role/Interface.pm ↑ Summary Engine/Role/Request.pm »