| 1 | package OX::Request; | ||||||||||||
| 2 | 42 | ▶ | BEGIN { | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 42 | $OX::Request::AUTHORITY = 'cpan:STEVAN'; | |||||||||||
| 4 | } | ||||||||||||
| 5 | 42 | $OX::Request::VERSION = '0.14'; | |||||||||||
| 6 | 42 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 42 | ▶ | use namespace::autoclean; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | # ABSTRACT: request object for OX | ||||||||||||
| 9 | |||||||||||||
| 10 | 42 | extends 'Web::Request' => { -version => 0.05 }; | |||||||||||
| 11 | |||||||||||||
| 12 | |||||||||||||
| 13 | 211 | ▶ | sub default_encoding { 'UTF-8' } | ||||||||||
|
Subroutine
default_encoding: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 14 | 406 | ▶ | sub response_class { 'OX::Response' } | ||||||||||
|
Subroutine
response_class: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 15 | |||||||||||||
| 16 | 32 | ▶ | sub _router { (shift)->env->{'ox.router'} } | ||||||||||
|
Subroutine
_router: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | |||||||||||||
| 18 | |||||||||||||
| 19 | 104 | ▶ | sub mapping { | ||||||||||
|
Subroutine
mapping: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||
| 20 | 104 | my $self = shift; | |||||||||||
| 21 | 104 | my $match = $self->env->{'plack.router.match'}; | |||||||||||
| 22 | 104 | ▶ | return unless $match; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 23 | 104 | return $match->mapping; | |||||||||||
| 24 | } | ||||||||||||
| 25 | |||||||||||||
| 26 | |||||||||||||
| 27 | 28 | ▶ | sub uri_for { | ||||||||||
|
Subroutine
uri_for: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||
| 28 | 28 | my ($self, $route) = @_; | |||||||||||
| 29 | |||||||||||||
| 30 | 28 | ▶ | my $uri_base = $self->script_name || '/'; | ||||||||||
|
Condition100%2/2
$self->script_name || '/'
MC/DC100%1/1
$self->script_name || '/'
$self->script_name
Truth table100%2/2
A
A= $self->script_name
| |||||||||||||
| 31 | 28 | ▶ | $uri_base .= '/' unless $uri_base =~ m+/$+; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 32 | |||||||||||||
| 33 | 28 | ▶ | if (!ref($route)) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 34 | 6 | $route = { name => $route }; | |||||||||||
| 35 | } | ||||||||||||
| 36 | |||||||||||||
| 37 | 28 | my $path_info = $self->_router->uri_for( %$route ); | |||||||||||
| 38 | |||||||||||||
| 39 | 28 | ▶ | confess "No URI found for route" | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 40 | unless defined($path_info); | ||||||||||||
| 41 | |||||||||||||
| 42 | 26 | return $uri_base . $path_info; | |||||||||||
| 43 | } | ||||||||||||
| 44 | |||||||||||||
| 45 | 42 | __PACKAGE__->meta->make_immutable; | |||||||||||
| 46 | |||||||||||||
| 47 | |||||||||||||
| 48 | 42 | 1; | |||||||||||
| 49 | |||||||||||||
| 50 | __END__ | ||||||||||||