Encoder/JSON.pm

filter: Statementstmt 100% 20 / 20 Branchbran 50.0% 1 / 2 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 3 totaltotal 88.2% 30 / 34 CC 4 SCAR 8.5
CC
4
Cov
96%
new
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
« Encoder/Data/MessagePack.pm ↑ Summary Encoder/Data/Dumper.pm »
1 package Data::Encoder::JSON;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod undocumented
8 3 my ($class, $args) = @_;
9 3 my $json = JSON->new;
10  
11 3 ▶ $args ||= {};
Condition100%2/2
$args ||= {}
l!l
12
MC/DC100%1/1
$args ||= {}
$args
Truth table100%2/2
A
A= $args
Aresult
11
00
12 3 for my $method (keys %$args) {
13 1 ▶ $json->$method(defined $args->{$method} ? $args->{$method} : ());
Branch: 1 branch
BranchTrueFalseTotal
defined $args->{$method} ? : 1 0 1
14 }
15  
16 bless {
17 3 json => $json,
18 }, __PACKAGE__;
19 }
20  
21 3 ▶sub encode {
Subroutine encode: called CC=1 SCAR=0.0
Pod undocumented
22 3 my ($self, $stuff, @args) = @_;
23 3 $self->{json}->encode($stuff, @args);
24 }
25  
26 1 ▶sub decode {
Subroutine decode: called CC=1 SCAR=0.0
Pod undocumented
27 1 my ($self, $stuff, @args) = @_;
28 1 $self->{json}->decode($stuff, @args);
29 }
30  
31 2 1;
32 __END__
« Encoder/Data/MessagePack.pm ↑ Summary Encoder/Data/Dumper.pm »