line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Articulate::Serialisation::StatusSetter; |
2
|
6
|
|
|
6
|
|
3526
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
217
|
|
3
|
6
|
|
|
6
|
|
27
|
use warnings; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
137
|
|
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
21
|
use Moo; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
27
|
|
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
|
|
|
|
|
|
|
sub serialise { |
21
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
22
|
0
|
|
|
|
|
|
my $response = shift; |
23
|
0
|
0
|
0
|
|
|
|
if ( ref $response and $response->can('http_code') ) { |
24
|
0
|
|
0
|
|
|
|
$self->framework->status( $response->http_code // 500 ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
else { |
27
|
0
|
|
|
|
|
|
$self->framework->status(500); |
28
|
|
|
|
|
|
|
} |
29
|
0
|
|
|
|
|
|
return undef; # we want to continue with other serialisations |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |