blib/lib/Data/Serializer/JSON/MaybeXS.pm

filter: Statementstmt 100% 25 / 25 Branchbran n/a Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod 66.6% 2 / 3 totaltotal 90.4% 38 / 42 CC 2 SCAR 1.8
CC
2
Cov
96%
json
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
↑ Summary
1 package Data::Serializer::JSON::MaybeXS;
2 1 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 our $VERSION = '0.03';
6  
7 1 ▶BEGIN { @Data::Serializer::JSON::MaybeXS::ISA = qw(Data::Serializer) }
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # This code was pretty much stolen and modified from:
10 # Data::Serializer::JSON.
11  
12 1 ▶use JSON::MaybeXS qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 ▶sub json {
Subroutine json: called CC=2 SCAR=7.0
Pod undocumented
16 2 my ($self) = @_;
17  
18 $self->{json} ||= JSON::MaybeXS->new(
19 2 ▶ %{ $self->{options} },
Condition66%2/3
$self->{"json"} ||= "JSON::MaybeXS"->new(%{$$self{"options"};})
l!l&&r!l&&!r
110
MC/DC0%0/2
$self->{"json"} ||= "JSON::MaybeXS"->new(%{$$self{"options"};})
$self->{"json"} "JSON::MaybeXS"->new(%{$$self{"options"};})
Truth table66%2/3
A ||= B
A= $self->{"json"}B= "JSON::MaybeXS"->new(%{$$self{"options"};})
ABresult
1X1
011
000
20 );
21  
22 2 return $self->{json};
23 }
24  
25 1 ▶sub serialize {
Subroutine serialize: called CC=1 SCAR=0.0
Pod documented
26 1 my ($self, $data) = @_;
27 1 return $self->json->encode( $data );
28 }
29  
30 1 ▶sub deserialize {
Subroutine deserialize: called CC=1 SCAR=0.0
Pod documented
31 1 my ($self, $json) = @_;
32 1 return $self->json->decode( $json );
33 }
34  
35 1 1;
36 __END__
↑ Summary