line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Engine::Types::Core; |
2
|
69
|
|
|
69
|
|
2084
|
use Any::Moose; |
|
69
|
|
|
|
|
145
|
|
|
69
|
|
|
|
|
577
|
|
3
|
|
|
|
|
|
|
use Any::Moose ( |
4
|
69
|
|
|
|
|
549
|
'X::Types' => [-declare => [qw/Interface Uri Header Handler/]], |
5
|
|
|
|
|
|
|
'X::Types::'.any_moose() , [qw/HashRef Str Object CodeRef ArrayRef/], |
6
|
69
|
|
|
69
|
|
41122
|
); |
|
69
|
|
|
|
|
158
|
|
7
|
|
|
|
|
|
|
|
8
|
69
|
|
|
69
|
|
474528
|
use URI; |
|
69
|
|
|
|
|
642624
|
|
|
69
|
|
|
|
|
2605
|
|
9
|
69
|
|
|
69
|
|
69196
|
use URI::WithBase; |
|
69
|
|
|
|
|
65711
|
|
|
69
|
|
|
|
|
1936
|
|
10
|
69
|
|
|
69
|
|
67923
|
use URI::QueryParam; |
|
69
|
|
|
|
|
55484
|
|
|
69
|
|
|
|
|
5888
|
|
11
|
69
|
|
|
69
|
|
576
|
use HTTP::Headers::Fast; |
|
69
|
|
|
|
|
142
|
|
|
69
|
|
|
|
|
47056
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
do { |
14
|
|
|
|
|
|
|
role_type Interface, { role => "HTTP::Engine::Role::Interface" }; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
coerce Interface, from HashRef, via { |
17
|
|
|
|
|
|
|
my $module = $_->{module}; |
18
|
|
|
|
|
|
|
my $plugins = $_->{plugins} || []; |
19
|
|
|
|
|
|
|
my $args = $_->{args}; |
20
|
|
|
|
|
|
|
$args->{request_handler} = $_->{request_handler}; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
if ( $module !~ s{^\+}{} ) { |
23
|
|
|
|
|
|
|
$module = join( '::', "HTTP", "Engine", "Interface", $module ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Any::Moose::load_class($module); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
return $module->new(%$args); |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
do { |
33
|
|
|
|
|
|
|
subtype Uri, as "URI::WithBase"; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
coerce Uri, from Str, via { |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# generate base uri |
38
|
|
|
|
|
|
|
my $uri = URI->new($_); |
39
|
|
|
|
|
|
|
my $base = $uri->path; |
40
|
|
|
|
|
|
|
$base =~ s{^/+}{}; |
41
|
|
|
|
|
|
|
$uri->path($base); |
42
|
|
|
|
|
|
|
$base .= '/' unless $base =~ /\/$/; |
43
|
|
|
|
|
|
|
$uri->query(undef); |
44
|
|
|
|
|
|
|
$uri->path($base); |
45
|
|
|
|
|
|
|
URI::WithBase->new( $_, $uri ); |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
do { |
50
|
|
|
|
|
|
|
subtype Header, |
51
|
|
|
|
|
|
|
as Object, |
52
|
|
|
|
|
|
|
where { $_->isa('HTTP::Headers::Fast') || $_->isa('HTTP::Headers') }; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
coerce Header, |
55
|
|
|
|
|
|
|
from ArrayRef, via { HTTP::Headers::Fast->new( @{$_} ) }; |
56
|
|
|
|
|
|
|
coerce Header, |
57
|
|
|
|
|
|
|
from HashRef, via { HTTP::Headers::Fast->new( %{$_} ) }; |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
do { |
61
|
|
|
|
|
|
|
subtype Handler, as CodeRef; |
62
|
|
|
|
|
|
|
coerce Handler, from Str, via { \&{$_} }; |
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |