| 1 | package Plack::Test::Server; | ||||||||||||||||||||
| 2 | 10 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 10 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 10 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 10 | ▶ | use HTTP::Request; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 10 | ▶ | use HTTP::Response; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 10 | ▶ | use Test::TCP; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 10 | ▶ | use Plack::Loader; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 10 | ▶ | use Plack::LWPish; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 11 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=10.3
Pod
undocumented
| |||||||||||||||||||||
| 12 | 11 | my($class, $app, %args) = @_; | |||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 11 | ▶ | my $host = $args{host} || '127.0.0.1'; | ||||||||||||||||||
|
Condition50%1/2
$args{'host'} || '127.0.0.1'
MC/DC0%0/1
$args{'host'} || '127.0.0.1'
$args{'host'}
Truth table50%1/2
A
A= $args{'host'}
| |||||||||||||||||||||
| 15 | my $server = Test::TCP->new( | ||||||||||||||||||||
| 16 | listen => $args{listen}, | ||||||||||||||||||||
| 17 | host => $host, | ||||||||||||||||||||
| 18 | 0 | ▶ | code => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||
| 19 | 0 | my $sock_or_port = shift; | |||||||||||||||||||
| 20 | my $server = Plack::Loader->auto( | ||||||||||||||||||||
| 21 | ($args{listen} ? ( | ||||||||||||||||||||
| 22 | 0 | ▶ | listen_sock => $sock_or_port, | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 23 | ):( | ||||||||||||||||||||
| 24 | port => $sock_or_port, | ||||||||||||||||||||
| 25 | host => $host, | ||||||||||||||||||||
| 26 | )) | ||||||||||||||||||||
| 27 | ); | ||||||||||||||||||||
| 28 | 0 | $server->run($app); | |||||||||||||||||||
| 29 | 0 | exit; | |||||||||||||||||||
| 30 | }, | ||||||||||||||||||||
| 31 | 11 | ); | |||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 11 | bless { server => $server, %args }, $class; | |||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 15 | ▶ | sub port { | ||||||||||||||||||
|
Subroutine
port: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 37 | 15 | my $self = shift; | |||||||||||||||||||
| 38 | 15 | $self->{server}->port; | |||||||||||||||||||
| 39 | } | ||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 15 | ▶ | sub request { | ||||||||||||||||||
|
Subroutine
request: called CC=3 SCAR=11.6
Pod
undocumented
| |||||||||||||||||||||
| 42 | 15 | my($self, $req) = @_; | |||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 15 | ▶ | my $ua = $self->{ua} || Plack::LWPish->new( no_proxy => [qw/127.0.0.1/] ); | ||||||||||||||||||
|
Condition33%1/3
$self->{'ua'} || 'Plack::LWPish'->new('no_proxy', ['127.0.0.1'])
MC/DC0%0/2
$self->{'ua'} || 'Plack::LWPish'->new('no_proxy', ['127.0.0.1'])
$self->{'ua'}
'Plack::LWPish'->new('no_proxy', ['127.0.0.1'])
Truth table33%1/3
A || B
A= $self->{'ua'}B= 'Plack::LWPish'->new('no_proxy', ['127.0.0.1'])
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 15 | $req->uri->scheme('http'); | |||||||||||||||||||
| 47 | 15 | ▶ | $req->uri->host($self->{host} || '127.0.0.1'); | ||||||||||||||||||
|
Condition50%1/2
$self->{'host'} || '127.0.0.1'
MC/DC0%0/1
$self->{'host'} || '127.0.0.1'
$self->{'host'}
Truth table50%1/2
A
A= $self->{'host'}
| |||||||||||||||||||||
| 48 | 15 | $req->uri->port($self->port); | |||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 15 | return $ua->request($req); | |||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 10 | 1; | |||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | __END__ | ||||||||||||||||||||