| 1 | #!perl | ||
| 2 | #PODNAME: Raisin::Encoder::JSON | ||
| 3 | #ABSTRACT: JSON serialization plugin for Raisin. | ||
| 4 | |||
| 5 | 6 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 6 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | package Raisin::Encoder::JSON; | ||
| 9 | 6 | $Raisin::Encoder::JSON::VERSION = '0.94'; | |
| 10 | 6 | ▶ | use JSON::MaybeXS qw(); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 6 | my $json = JSON::MaybeXS->new(utf8 => 1); | |
| 13 | |||
| 14 | 71 | ▶ | sub detectable_by { [qw(application/json text/x-json text/json json)] } |
|
Subroutine
detectable_by: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 15 | |||
| 16 | 9 | ▶ | sub content_type { 'application/json; charset=utf-8' } |
|
Subroutine
content_type: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 17 | |||
| 18 | 9 | ▶ | sub serialize { $json->allow_blessed->convert_blessed->encode($_[1]) } |
|
Subroutine
serialize: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 19 | |||
| 20 | 9 | ▶ | sub deserialize { $json->allow_blessed->convert_blessed->decode($_[1]->content) } |
|
Subroutine
deserialize: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 21 | |||
| 22 | 6 | 1; | |
| 23 | |||
| 24 | __END__ | ||