lib/DR/Tnt/Msgpack/Types/Blob.pm

filter: Statementstmt 100% 26 / 26 Branchbran 87.5% 7 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 3 totaltotal 83.6% 41 / 49 SCAR 17.9
CC
6
Cov
92%
TO_MSGPACK
5.0
new
2.3
BEGIN
1.0
CRAP 6.0
« blib/lib/DR/Tnt/Dumper.pm ↑ Summary lib/DR/Tnt.pm »
1 11 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package DR::Tnt::Msgpack::Types::Blob;
6 11 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 11 $Carp::Internal{ (__PACKAGE__) }++;
8  
9 sub new {
10 13 ▶ my ($class, $v) = @_;
Subroutine new: called CC=2 SCAR=8.1
Pod undocumented
11 13 ▶ bless \$v => ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
0130
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
12 }
13  
14 sub TO_MSGPACK {
15 10 ▶ my ($self) = @_;
Subroutine TO_MSGPACK: called CC=5 SCAR=16.1
Pod undocumented
16 10 my $v = $$self;
17  
18 10 ▶ return pack 'C', 0xC0 unless defined $v;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $v 0 10 10
19  
20 10 ▶ utf8::encode $v if utf8::is_utf8 $v;
Branch: 1 branch
BranchTrueFalseTotal
if utf8::is_utf8($v) 1 9 10
21 10 my $len = length $v;
22  
23 10 ▶ return pack 'CC/a*', 0xC4, $v if $len <= 0xFF;
Branch: 1 branch
BranchTrueFalseTotal
if $len <= 255 8 2 10
24 2 ▶ return pack 'CS>/a*', 0xC5, $v if $len <= 0xFFFF;
Branch: 1 branch
BranchTrueFalseTotal
if $len <= 65535 1 1 2
25 1 return pack 'CL>/a*', 0xC6, $v;
26 }
27  
28 sub TO_JSON {
29 1 ▶ my ($self) = @_;
Subroutine TO_JSON: called CC=1 SCAR=0.0
Pod undocumented
30 1 return $$self;
31 }
32  
33 =head1 NAME
34  
35 DR::Tnt::Msgpack::Types::Blob - container for blob.
36  
37 =head1 SYNOPSIS
38  
39 use DR::Tnt::Msgpack::Types::Blob;
40  
41 my $o = DR::Tnt::Msgpack::Types::Blob->new(123);
42 my $blob = msgpack($o);
43  
44 =head1 DESCRIPTION
45  
46 See L<DR::Tnt::Msgpack::Types>.
47  
48 =cut
49  
50 11 1;
51  
« blib/lib/DR/Tnt/Dumper.pm ↑ Summary lib/DR/Tnt.pm »