| 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'} || []
MC/DC0%0/1
$_->{'plugins'} || []
$_->{'plugins'}
Truth table50%1/2
A
A= $_->{'plugins'}
| |||||||||||||
| 19 | 39 | my $args = $_->{args}; | |||||||||||
| 20 | 39 | $args->{request_handler} = $_->{request_handler}; | |||||||||||
| 21 | |||||||||||||
| 22 | 39 | ▶ | if ( $module !~ s{^\+}{} ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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
| |||||||||||||
| 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
| |||||||||||||
| 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__ | ||||||||||||