File Coverage

blib/lib/Raisin/Encoder/JSON.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 4 0.0
total 20 24 83.3


line stmt bran cond sub pod time code
1             #!perl
2             #PODNAME: Raisin::Encoder::JSON
3             #ABSTRACT: JSON serialization plugin for Raisin.
4              
5 5     5   1769 use strict;
  5         10  
  5         124  
6 5     5   20 use warnings;
  5         9  
  5         236  
7              
8             package Raisin::Encoder::JSON;
9             $Raisin::Encoder::JSON::VERSION = '0.94';
10 5     5   27 use JSON::MaybeXS qw();
  5         12  
  5         606  
11              
12             my $json = JSON::MaybeXS->new(utf8 => 1);
13              
14 71     71 0 214 sub detectable_by { [qw(application/json text/x-json text/json json)] }
15              
16 9     9 0 209 sub content_type { 'application/json; charset=utf-8' }
17              
18 9     9 0 162 sub serialize { $json->allow_blessed->convert_blessed->encode($_[1]) }
19              
20 9     9 0 46 sub deserialize { $json->allow_blessed->convert_blessed->decode($_[1]->content) }
21              
22             1;
23              
24             __END__