blib/lib/Raisin/Encoder/Text.pm

filter: Statementstmt 90.9% 20 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 4 totaltotal 79.4% 27 / 34 CC 1 SCAR 1.2
CC
1
Cov
91%
deserialize
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« examples/sample-app/lib/RESTApp.pm ↑ Summary examples/sample-app/lib/RESTApp/User.pm »
1 #!perl
2 #PODNAME: Raisin::Encoder::Text
3 #ABSTRACT: Data::Dumper serialization plugin for Raisin.
4  
5 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 package Raisin::Encoder::Text;
9 5 $Raisin::Encoder::Text::VERSION = '0.94';
10 5 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 ▶use Encode 'encode';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 51 ▶sub detectable_by { [qw(text/plain txt)] }
Subroutine detectable_by: called CC=1 SCAR=0.0
Pod undocumented
14 4 ▶sub content_type { 'text/plain; charset=utf-8' }
Subroutine content_type: called CC=1 SCAR=0.0
Pod undocumented
15  
16 4 ▶sub serialize {
Subroutine serialize: called CC=1 SCAR=0.0
Pod undocumented
17 4 my ($self, $data) = @_;
18  
19 4 $data = Data::Dumper->new([$data], ['data'])
20 ->Sortkeys(1)
21 ->Purity(1)
22 ->Terse(1)
23 ->Deepcopy(1)
24 ->Dump;
25 4 $data = encode('UTF-8', $data);
26 4 $data;
27 }
28  
29 0 ▶sub deserialize {
Subroutine deserialize: not called CC=1 SCAR=6.9
Pod undocumented
30 0 Raisin::log(error => 'Raisin:Encoder::Text doesn\'t support deserialization');
31 0 die;
32 }
33  
34 5 1;
35  
36 __END__
« examples/sample-app/lib/RESTApp.pm ↑ Summary examples/sample-app/lib/RESTApp/User.pm »