Engine/Types/Core.pm

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