blib/lib/Froody/Renderer/json.pm

filter: Statementstmt 80.7% 21 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod n/a totaltotal 79.4% 27 / 34 CC 1 SCAR 2.2
CC
1
Cov
81%
__ANON__
2.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Froody/Argument/Email.pm ↑ Summary blib/lib/Froody/Response/String.pm »
1 package Froody::Renderer::json;
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  
5 10 ▶use JSON::Syck;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 10 ▶use Froody::Response;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 10 ▶use Froody::Response::Terse;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # If we don't know how to do it ourselves, convert to
12 # a terse and try again
13 0 ▶*Froody::Response::render_json = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
14 0 my $self = shift;
15 0 return $self->as_terse->render_json;
16 10 };
17  
18 # Terse format just gets the main data structure out
19 # and renders it with JSON
20 0 ▶*Froody::Response::Terse::render_json = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
21 0 my $self = shift;
22 0 local $JSON::Syck::ImplicitUnicode = 1; # bah.
23 0 return Encode::encode_utf8( # BAH
24 JSON::Syck::Dump({ stat => $self->status, data => $self->content })
25 );
26 10 };
27  
28 10 1;
« blib/lib/Froody/Argument/Email.pm ↑ Summary blib/lib/Froody/Response/String.pm »