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