| 1 | package Plack::Client::Backend::http; | ||||||||||||||||||||||||||||
| 2 | 5 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 5 | $Plack::Client::Backend::http::VERSION = '0.06'; | |||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | # ABSTRACT: backend for handling HTTP requests | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use Plack::App::Proxy; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 5 | ▶ | use base 'Plack::Client::Backend'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 4 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.6
Pod
documented
| |||||||||||||||||||||||||||||
| 16 | 4 | my $class = shift; | |||||||||||||||||||||||||||
| 17 | 4 | my %args = @_; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | $args{proxy} ||= Plack::App::Proxy->new( | ||||||||||||||||||||||||||||
| 20 | exists $args{proxy_args} ? $args{proxy_args} : () | ||||||||||||||||||||||||||||
| 21 | 4 | ▶ | ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{"proxy"} ||= "Plack::App::Proxy"->new(exists $args{"proxy_args"} ? $args{"proxy_args"} : ())
MC/DC0%0/2
$args{"proxy"} ||= "Plack::App::Proxy"->new(exists $args{"proxy_args"} ? $args{"proxy_args"} : ())
$args{"proxy"}
"Plack::App::Proxy"->new(exists $args{"proxy_args"} ? $args{"proxy_args"} : ())
Truth table33%1/3
A ||= B
A= $args{"proxy"}B= "Plack::App::Proxy"->new(exists $args{"proxy_args"} ? $args{"proxy_args"} : ())
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 4 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 4 | $self->{proxy} = $args{proxy}->to_app; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 4 | return $self; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 38 | ▶ | sub _proxy { shift->{proxy} } | ||||||||||||||||||||||||||
|
Subroutine
_proxy: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 38 | ▶ | sub app_from_request { | ||||||||||||||||||||||||||
|
Subroutine
app_from_request: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 34 | 38 | my $self = shift; | |||||||||||||||||||||||||||
| 35 | 38 | my ($req) = @_; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 38 | my $uri = $req->uri->clone; | |||||||||||||||||||||||||||
| 38 | 38 | $uri->path('/'); | |||||||||||||||||||||||||||
| 39 | 38 | $uri->query(undef); | |||||||||||||||||||||||||||
| 40 | 38 | $req->env->{'plack.proxy.remote'} = $uri->as_string; | |||||||||||||||||||||||||||
| 41 | 38 | return $self->_proxy; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 5 | 1; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||||||||||