| 1 | package Thunderhorse::Response; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 24 | $Thunderhorse::Response::VERSION = '0.107'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 24 | ▶ | use v5.40; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 24 | ▶ | use Mooish::Base -standard; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 24 | ▶ | use Gears::X::Thunderhorse; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 24 | extends 'PAGI::Response'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 24 | with 'Thunderhorse::Message'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 111 | ▶ | sub FOREIGNBUILDARGS ($class, %args) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FOREIGNBUILDARGS: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | Gears::X::Thunderhorse->raise('no context for response') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 111 | ▶ | unless $args{context}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 111 | return ($args{context}->pagi->[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 106 | ▶ | sub update ($self, $scope, $receive, $send) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 106 | $self->{scope} = $scope; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | sub _allows_empty_body ($self, $status) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_allows_empty_body: called CC=4 SCAR=20.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # HTTP protocol hardcodes - these statuses can have empty bodies | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | ▶ | return $status < 200 | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%3/9
$status < 200 || $status == 204 || $status >= 300 && $status < 400
$status < 200 or $status == 204
$status >= 300 and $status < 400
MC/DC0%0/4
$status < 200 || $status == 204 || $status >= 300 && $status < 400
$status < 200
$status == 204
$status >= 300
$status < 400
Truth table20%1/5
A or B || C and D
A= $status < 200B= $status == 204C= $status >= 300D= $status < 400
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | || $status == 204 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | || ($status >= 300 && $status < 400); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 203 | ▶ | sub is_ready ($self) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_ready: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 203 | ▶ | return true if $self->has_body_source; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 119 | ▶ | return $self->_allows_empty_body($self->status) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | if $self->has_status; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 118 | return false; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||