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   2224 use strict;
  5         12  
  5         152  
6 5     5   25 use warnings;
  5         9  
  5         235  
7              
8             package Raisin::Encoder::JSON;
9             $Raisin::Encoder::JSON::VERSION = '0.93';
10 5     5   31 use JSON::MaybeXS qw();
  5         10  
  5         716  
11              
12             my $json = JSON::MaybeXS->new(utf8 => 1);
13              
14 60     60 0 223 sub detectable_by { [qw(application/json text/x-json text/json json)] }
15              
16 7     7 0 145 sub content_type { 'application/json; charset=utf-8' }
17              
18 7     7 0 186 sub serialize { $json->allow_blessed->convert_blessed->encode($_[1]) }
19              
20 3     3 0 135 sub deserialize { $json->allow_blessed->convert_blessed->decode($_[1]) }
21              
22             1;
23              
24             __END__