line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::Engine::Types::Core; |
2
|
59
|
|
|
59
|
|
222
|
use Any::Moose; |
|
59
|
|
|
|
|
73
|
|
|
59
|
|
|
|
|
316
|
|
3
|
|
|
|
|
|
|
use Any::Moose ( |
4
|
59
|
|
|
|
|
342
|
'X::Types' => [-declare => [qw/Interface Uri Header Handler/]], |
5
|
59
|
|
|
59
|
|
21913
|
); |
|
59
|
|
|
|
|
82
|
|
6
|
|
|
|
|
|
|
|
7
|
59
|
|
|
59
|
|
112243
|
use URI; |
|
59
|
|
|
|
|
269529
|
|
|
59
|
|
|
|
|
1593
|
|
8
|
59
|
|
|
59
|
|
21685
|
use URI::WithBase; |
|
59
|
|
|
|
|
38343
|
|
|
59
|
|
|
|
|
1280
|
|
9
|
59
|
|
|
59
|
|
21866
|
use URI::QueryParam; |
|
59
|
|
|
|
|
33216
|
|
|
59
|
|
|
|
|
1453
|
|
10
|
59
|
|
|
59
|
|
252
|
use HTTP::Headers::Fast; |
|
59
|
|
|
|
|
72
|
|
|
59
|
|
|
|
|
20920
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
do { |
13
|
|
|
|
|
|
|
role_type Interface, { role => "HTTP::Engine::Role::Interface" }; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
coerce Interface, from 'HashRef' => via { |
16
|
|
|
|
|
|
|
my $module = $_->{module}; |
17
|
|
|
|
|
|
|
my $plugins = $_->{plugins} || []; |
18
|
|
|
|
|
|
|
my $args = $_->{args}; |
19
|
|
|
|
|
|
|
$args->{request_handler} = $_->{request_handler}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
if ( $module !~ s{^\+}{} ) { |
22
|
|
|
|
|
|
|
$module = join( '::', "HTTP", "Engine", "Interface", $module ); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Any::Moose::load_class($module); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
return $module->new(%$args); |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
do { |
32
|
|
|
|
|
|
|
class_type Uri, { class => "URI::WithBase" }; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
coerce Uri, from 'Str' => via { |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# generate base uri |
37
|
|
|
|
|
|
|
my $uri = URI->new($_); |
38
|
|
|
|
|
|
|
my $base = $uri->path; |
39
|
|
|
|
|
|
|
$base =~ s{^/+}{}; |
40
|
|
|
|
|
|
|
$uri->path($base); |
41
|
|
|
|
|
|
|
$base .= '/' unless $base =~ /\/$/; |
42
|
|
|
|
|
|
|
$uri->query(undef); |
43
|
|
|
|
|
|
|
$uri->path($base); |
44
|
|
|
|
|
|
|
URI::WithBase->new( $_, $uri ); |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
do { |
49
|
|
|
|
|
|
|
subtype Header, |
50
|
|
|
|
|
|
|
as 'Object', |
51
|
|
|
|
|
|
|
where { $_->isa('HTTP::Headers::Fast') || $_->isa('HTTP::Headers') }; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
coerce Header, |
54
|
|
|
|
|
|
|
from 'ArrayRef' => via { HTTP::Headers::Fast->new( @{$_} ) }, |
55
|
|
|
|
|
|
|
from 'HashRef' => via { HTTP::Headers::Fast->new( %{$_} ) }; |
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
do { |
59
|
|
|
|
|
|
|
subtype Handler, as 'CodeRef'; |
60
|
|
|
|
|
|
|
coerce Handler, from 'Str' => via { \&{$_} }; |
61
|
|
|
|
|
|
|
}; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |