blib/lib/DR/Msgpuck.pm

filter: Statementstmt 82.9% 39 / 47 Branchbran 66.6% 4 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 12 / 16 Podpod n/a totaltotal 75.6% 56 / 74 CC 5 SCAR 7.3
CC
5
Cov
79%
TO_JSON
6.0
new
3.1
__ANON__
2.0
CRAP 2.1
↑ Summary msgpuck.h »
1 3 ▶use 5.014002;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package DR::Msgpuck::Bool;
6  
7  
8 use overload
9 0 ▶ bool => sub { ${ $_[0] } },
Subroutine __ANON__: not called CC=1 SCAR=6.9
10 0 ▶ int => sub { ${ $_[0] } },
Subroutine __ANON__: not called CC=1 SCAR=6.9
11 0 ▶ '!' => sub { $_[0]->new(!${ $_[0] }) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
12 2 ▶ '""' => sub { ${ $_[0] } },
Subroutine __ANON__: called CC=1 SCAR=0.0
13 3 ▶;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 sub TO_JSON {
16 0 ▶ my ($self) = @_;
Subroutine TO_JSON: not called CC=2 SCAR=17.9
17 0 ▶ $$self ? 'true' : 'false';
Branch: 1 branch
BranchTrueFalseTotal
$$self ? : 0 0 0
18 }
19  
20 sub TO_MSGPACK {
21 14 ▶ my ($self) = @_;
Subroutine TO_MSGPACK: called CC=2 SCAR=6.9
22 14 ▶ pack 'C', $$self ? 0xC3 : 0xC2;
Branch: 1 branch
BranchTrueFalseTotal
$$self ? : 7 7 14
23 }
24  
25 sub new {
26 6 ▶ my ($class, $v) = @_;
Subroutine new: called CC=3 SCAR=11.4
27 6 ▶ $v = $v ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$v ? : 3 3 6
28 6 ▶ bless \$v => ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
060
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
29 }
30  
31 package DR::Msgpuck::True;
32 3 ▶use base 'DR::Msgpuck::Bool';
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 sub new {
35 3 ▶ my ($class) = @_;
Subroutine new: called CC=1 SCAR=0.0
36 3 $class->SUPER::new(1);
37 }
38  
39 package DR::Msgpuck::False;
40 3 ▶use base 'DR::Msgpuck::Bool';
Subroutine BEGIN: called CC=1 SCAR=0.0
41  
42 sub new {
43 3 ▶ my ($class) = @_;
Subroutine new: called CC=1 SCAR=0.0
44 3 $class->SUPER::new(0);
45 }
46  
47  
48 package DR::Msgpuck;
49 3 require Exporter;
50 3 ▶use AutoLoader qw(AUTOLOAD);
Subroutine BEGIN: called CC=1 SCAR=0.0
51  
52 3 our @ISA = qw(Exporter);
53 3 our @EXPORT_OK = qw(msgpack msgunpack msgunpack_utf8);
54 3 our @EXPORT = @EXPORT_OK;
55 3 our $VERSION = '0.01';
56  
57 3 require XSLoader;
58 3 XSLoader::load('DR::Msgpuck', $VERSION);
59  
60 3 1;
61 __END__
↑ Summary msgpuck.h »