blib/lib/DR/Msgpuck/Str.pm

filter: Statementstmt 79.4% 27 / 34 Branchbran 71.4% 10 / 14 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 70.0% 7 / 10 Podpod 0.0% 0 / 2 totaltotal 69.2% 45 / 65 CC 9 SCAR 12.6
CC
9
Cov
75%
__ANON__
6.0
TO_MSGPACK
5.1
new
4.2
CRAP 3.5
↑ Summary blib/lib/DR/Msgpuck/Num.pm »
1 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package DR::Msgpuck::Str;
6 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 use overload
8 0 ▶ bool => sub { ${ $_[0] } ? 1 : 0 },
Subroutine BEGIN: called CC=1 SCAR=3.3
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
${$_[0];} ? : 0 0 0
9 0 ▶ int => sub { int ${ $_[0] } },
Subroutine __ANON__: not called CC=1 SCAR=6.9
10 0 ▶ '""' => sub { ${ $_[0] } },
Subroutine __ANON__: not called CC=1 SCAR=6.9
11 2 ;
12  
13 10 ▶sub TO_MSGPACK {
Subroutine TO_MSGPACK: called CC=5 SCAR=16.2
Pod undocumented
14 10 my ($self) = @_;
15 10 my $len = length $$self;
16 10 ▶ return pack 'Ca*', 0xA0| $len, $$self if $len < 0x20;
Branch: 1 branch
BranchTrueFalseTotal
if $len < 32 4 6 10
17 6 ▶ return pack 'CCa*', 0xD9, $len, $$self if $len < 0x1_00;
Branch: 1 branch
BranchTrueFalseTotal
if $len < 256 2 4 6
18 4 ▶ return pack 'Cs>a*', 0xDA, $len, $$self if $len < 0x1_0000;
Branch: 1 branch
BranchTrueFalseTotal
if $len < 65536 2 2 4
19 2 ▶ return pack 'Cl>a*', 0xDB, $len, $$self if $len <= 0xFFFF_FFFF;
Branch: 1 branch
BranchTrueFalseTotal
if $len <= 4294967295 2 0 2
20 0 croak "Too long line ($len bytes) can't be packed as msgpack";
21 }
22  
23 10 ▶sub new {
Subroutine new: called CC=4 SCAR=14.5
Pod undocumented
24 10 my ($class, $v) = @_;
25 10 ▶ croak 'usage DR::Msgpuck::Str->new($str)' unless defined $v;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $v 0 10 10
26 10 $v = "$v";
27 10 ▶ utf8::encode $v if utf8::is_utf8 $v;
Branch: 1 branch
BranchTrueFalseTotal
if utf8::is_utf8($v) 4 6 10
28 10 ▶ bless \$v => ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
0100
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 2 1;
32  
33 __END__
↑ Summary blib/lib/DR/Msgpuck/Num.pm »