JSONObject.pm

filter: Statementstmt 100% 37 / 37 Branchbran 50.0% 4 / 8 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 83.3% 55 / 66 CC 7 SCAR 11.6
CC
7
Cov
86%
from_json
6.8
to_json
2.0
BEGIN
1.0
CRAP 3.2
« JSONObject/Util.pm ↑ Summary JSONObject/Meta/Trait.pm »
1 #!/usr/bin/perl
2  
3 package MooseX::Role::JSONObject;
4  
5 4 ▶use v5.012;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 4 ▶use version; our $VERSION = version->declare("v0.1.0");
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use Method::Signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 4 ▶use MooseX::Role::JSONObject::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 4 method to_json()
17 4 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine to_json: called CC=2 SCAR=7.0
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ > 0 0 9 9
18 9 return MooseX::Role::JSONObject::Util::meta_to_json(
19 $self, $self->meta);
20 }
21  
22 4 method from_json($class:, HashRef $data)
23 4 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine from_json: called CC=6 SCAR=19.2
Branch: 3 branches
BranchTrueFalseTotal
unless scalar @_ > 0 0 3 3
unless ($Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef"))->check($data) 0 3 3
if scalar @_ > 1 0 3 3
Condition66%2/3
$Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef")
l!l&&r!l&&!r
120
MC/DC0%0/2
$Method::Signatures::mutc{"cache"}{"HashRef"} ||= "Method::Signatures"->_make_constraint("HashRef")
$Method::Signatures::mutc{"cache"}{"HashRef"} "Method::Signatures"->_make_constraint("HashRef")
Truth table66%2/3
A ||= B
A= $Method::Signatures::mutc{"cache"}{"HashRef"}B= "Method::Signatures"->_make_constraint("HashRef")
ABresult
1X1
011
000
24 3 ▶ my $cls = ref $class || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
030
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
25 3 my $meta = Class::MOP::Class->initialize($cls);
26  
27 3 return MooseX::Role::JSONObject::Util::meta_from_json(
28 $data, $meta);
29 }
30  
31 4 1;
32 __END__
« JSONObject/Util.pm ↑ Summary JSONObject/Meta/Trait.pm »