Articulate/Serialisation/StatusSetter.pm

filter: Statementstmt 64.7% 11 / 17 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 46.8% 15 / 32 CC 4 SCAR 24.7
CC
4
Cov
46%
serialise
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 11.9
« Articulate/Flow/ContentType.pm ↑ Summary Articulate/Sortation/Slug.pm »
1 package Articulate::Serialisation::StatusSetter;
2 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 5 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 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 sub serialise {
21 0 ▶ my $self = shift;
Subroutine serialise: not called CC=4 SCAR=30.0
Pod documented
22 0 my $response = shift;
23 0 ▶ if ( ref $response and $response->can('http_code') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $response and $response->can('http_code')) { } 0 0 0
Condition0%0/3
ref $response and $response->can("http_code")
!ll&&!rl&&r
000
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")
ABresult
0X0
100
111
24 0 ▶ $self->framework->status( $response->http_code // 500 );
Condition0%0/2
$response->http_code // 500
l!l
00
MC/DC0%0/1
$response->http_code // 500
$response->http_code
Truth table0%0/2
A
A= $response->http_code
Aresult
11
00
25 }
26 else {
27 0 $self->framework->status(500);
28 }
29 0 return undef; # we want to continue with other serialisations
30 }
31  
32 5 1;
« Articulate/Flow/ContentType.pm ↑ Summary Articulate/Sortation/Slug.pm »