Encoder/Data/MessagePack.pm

filter: Statementstmt 100% 23 / 23 Branchbran 50.0% 2 / 4 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 3 totaltotal 87.1% 34 / 39 CC 5 SCAR 11.1
CC
5
Cov
93%
new
5.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« Encoder.pm ↑ Summary Encoder/JSON.pm »
1 package Data::Encoder::Data::MessagePack;
2  
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 ▶use Data::MessagePack;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 my $ooish = $Data::MessagePack::VERSION >= 0.36;
8  
9 2 ▶sub new {
Subroutine new: called CC=5 SCAR=16.2
Pod undocumented
10 2 my ($class, $args) = @_;
11 2 my $mp = 'Data::MessagePack';
12 2 ▶ if ($ooish) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ooish) 2 0 2
13 2 $mp = Data::MessagePack->new;
14 2 ▶ $args ||= {};
Condition100%2/2
$args ||= {}
l!l
11
MC/DC100%1/1
$args ||= {}
$args
Truth table100%2/2
A
A= $args
Aresult
11
00
15 2 for my $method (keys %$args) {
16 3 ▶ $mp->$method(defined $args->{$method} ? $args->{$method} : ());
Branch: 1 branch
BranchTrueFalseTotal
defined $args->{$method} ? : 3 0 3
17 }
18 }
19 2 bless { mp => $mp }, __PACKAGE__;
20 }
21  
22 2 ▶sub encode {
Subroutine encode: called CC=1 SCAR=0.0
Pod undocumented
23 2 my ($self, $stuff, @args) = @_;
24 2 $self->{mp}->pack($stuff);
25 }
26  
27 2 ▶sub decode {
Subroutine decode: called CC=1 SCAR=0.0
Pod undocumented
28 2 my ($self, $stuff, @args) = @_;
29 2 $self->{mp}->unpack($stuff);
30 }
31  
32 1 1;
33 __END__
« Encoder.pm ↑ Summary Encoder/JSON.pm »