Engine/Types/Core.pm

filter: Statementstmt 92.7% 51 / 55 Branchbran 83.3% 5 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 83.3% 10 / 12 Podpod n/a totaltotal 88.1% 67 / 76 CC 5 SCAR 5.1
CC
5
Cov
90%
__ANON__
3.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.7
« Engine/Request/Upload.pm ↑ Summary Engine/Role/ResponseWriter/OutputHeader.pm »
1 package HTTP::Engine::Types::Core;
2 69 ▶use Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 69 ▶use Any::Moose (
Subroutine BEGIN: called CC=1 SCAR=0.0
4 69 'X::Types' => [-declare => [qw/Interface Uri Header Handler/]],
5 'X::Types::'.any_moose() , [qw/HashRef Str Object CodeRef ArrayRef/],
6 69 );
7  
8 69 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 69 ▶use URI::WithBase;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 69 ▶use URI::QueryParam;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 69 ▶use HTTP::Headers::Fast;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 69 do {
14 69 role_type Interface, { role => "HTTP::Engine::Role::Interface" };
15  
16 39 ▶ coerce Interface, from HashRef, via {
Subroutine __ANON__: called CC=3 SCAR=11.1
17 39 my $module = $_->{module};
18 39 ▶ my $plugins = $_->{plugins} || [];
Condition50%1/2
$_->{'plugins'} || []
l!l
039
MC/DC0%0/1
$_->{'plugins'} || []
$_->{'plugins'}
Truth table50%1/2
A
A= $_->{'plugins'}
Aresult
11
00
19 39 my $args = $_->{args};
20 39 $args->{request_handler} = $_->{request_handler};
21  
22 39 ▶ if ( $module !~ s{^\+}{} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($module =~ s/^\+//) 39 0 39
23 39 $module = join( '::', "HTTP", "Engine", "Interface", $module );
24 }
25  
26 39 Any::Moose::load_class($module);
27  
28 39 return $module->new(%$args);
29 69 };
30 };
31  
32 69 do {
33 69 subtype Uri, as "URI::WithBase";
34  
35 13 ▶ coerce Uri, from Str, via {
Subroutine __ANON__: called CC=2 SCAR=6.9
36  
37 # generate base uri
38 13 my $uri = URI->new($_);
39 13 my $base = $uri->path;
40 13 $base =~ s{^/+}{};
41 13 $uri->path($base);
42 13 ▶ $base .= '/' unless $base =~ /\/$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $base =~ m[/$] 12 1 13
43 13 $uri->query(undef);
44 13 $uri->path($base);
45 13 URI::WithBase->new( $_, $uri );
46 69 };
47 };
48  
49 69 do {
50 subtype Header,
51 as Object,
52 237 ▶ where { $_->isa('HTTP::Headers::Fast') || $_->isa('HTTP::Headers') };
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
$_->isa("HTTP::Headers::Fast") or $_->isa("HTTP::Headers") 177 60 237
53  
54 coerce Header,
55 0 ▶ from ArrayRef, via { HTTP::Headers::Fast->new( @{$_} ) };
Subroutine __ANON__: not called CC=1 SCAR=2.6
56 coerce Header,
57 7 ▶ from HashRef, via { HTTP::Headers::Fast->new( %{$_} ) };
Subroutine __ANON__: called CC=1 SCAR=0.0
58 };
59  
60 69 do {
61 69 subtype Handler, as CodeRef;
62 0 ▶ coerce Handler, from Str, via { \&{$_} };
Subroutine __ANON__: not called CC=1 SCAR=2.6
63 };
64  
65 69 1;
66  
67 __END__
« Engine/Request/Upload.pm ↑ Summary Engine/Role/ResponseWriter/OutputHeader.pm »