blib/lib/Dancer/Serializer/Dumper.pm

filter: Statementstmt 91.6% 33 / 36 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.9% 10 / 11 Podpod 0.0% 0 / 5 totaltotal 81.4% 44 / 54 SCAR 7.0
CC
2
Cov
89%
deserialize
2.0
from_dumper
2.0
BEGIN
1.0
CRAP 2.0
« blib/lib/Dancer/Object/Singleton.pm ↑ Summary blib/lib/Dancer/Logger/Console.pm »
1 package Dancer::Serializer::Dumper;
2 170 our $AUTHORITY = 'cpan:SUKRIA';
3 # ABSTRACT: Data::Dumper serialisation for Dancer
4 170 $Dancer::Serializer::Dumper::VERSION = '1.3520';
5 170 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 170 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 170 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 170 ▶use base 'Dancer::Serializer::Abstract';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 170 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 170 ▶use Dancer::Exception qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub from_dumper {
13 0 ▶ my ($string) = @_;
Subroutine from_dumper: not called CC=1 SCAR=6.9
Pod undocumented
14 0 my $s = Dancer::Serializer::Dumper->new;
15 0 $s->deserialize($string);
16 }
17  
18 sub to_dumper {
19 1 ▶ my ($data) = @_;
Subroutine to_dumper: called CC=1 SCAR=0.0
Pod undocumented
20 1 my $s = Dancer::Serializer::Dumper->new;
21 1 $s->serialize($data);
22 }
23  
24 sub serialize {
25 2 ▶ my ($self, $entity) = @_;
Subroutine serialize: called CC=1 SCAR=0.0
Pod undocumented
26 {
27 2 local $Data::Dumper::Purity = 1;
28 2 return Dumper($entity);
29 }
30 }
31  
32 sub deserialize {
33 1 ▶ my ($self, $content) = @_;
Subroutine deserialize: called CC=2 SCAR=7.0
Pod undocumented
34 1 my $res = eval "my \$VAR1; $content";
35 1 ▶ raise core_serializer => "unable to deserialize : $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 1 1
36 1 return $res;
37 }
38  
39 1 ▶sub content_type {'text/x-data-dumper'}
Subroutine content_type: called CC=1 SCAR=0.0
Pod undocumented
40  
41 170 1;
42  
43 __END__
« blib/lib/Dancer/Object/Singleton.pm ↑ Summary blib/lib/Dancer/Logger/Console.pm »