| 1 | package Articulate::Serialisation::StatusSetter; | ||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 6 | with 'Articulate::Role::Component'; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | =head1 NAME | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | Articulate::Serialisation::StatusSetter - send the right HTTP status response | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | =head1 METHODS | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =head3 serialise | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | Sets the status of the Dancer response you're going to be sending to match the status of the Articulate Response. | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =cut | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 0 | ▶ | sub serialise { | ||||||||||||||||||||||||||
|
Subroutine
serialise: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 21 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 22 | 0 | my $response = shift; | |||||||||||||||||||||||||||
| 23 | 0 | ▶ | if ( ref $response and $response->can('http_code') ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $response and $response->can("http_code")
MC/DC0%0/2
ref $response and $response->can("http_code")
ref $response
$response->can("http_code")
Truth table0%0/3
A and B
A= ref $responseB= $response->can("http_code")
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | $self->framework->status( $response->http_code // 500 ); | ||||||||||||||||||||||||||
|
Condition0%0/2
$response->http_code // 500
MC/DC0%0/1
$response->http_code // 500
$response->http_code
Truth table0%0/2
A
A= $response->http_code
| |||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | else { | ||||||||||||||||||||||||||||
| 27 | 0 | $self->framework->status(500); | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | 0 | return undef; # we want to continue with other serialisations | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 6 | 1; | |||||||||||||||||||||||||||