blib/lib/WebDyne/Cloudflare/D1/Blob.pm

filter: Statementstmt 95.2% 20 / 21 Branchbran 100% 4 / 4 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 3 totaltotal 87.5% 35 / 40 CC 4 SCAR 8.3
CC
4
Cov
96%
new
4.0
bytes
2.0
BEGIN
1.0
CRAP 2.3
« blib/lib/WebDyne/Cloudflare/R2/Blob.pm ↑ Summary blib/lib/WebDyne/Cloudflare/SecretsStore/Error.pm »
1 package WebDyne::Cloudflare::D1::Blob;
2  
3 5 ▶use 5.020;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use MIME::Base64 qw(encode_base64);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 5 our $VERSION='0.001';
9  
10 23 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod undocumented
11 23 my ($class, $bytes)=@_;
12 23 ▶ die "D1 blob requires a defined byte string\n"
Branch: 1 branch
BranchTrueFalseTotal
if not defined $bytes or ref $bytes 3 20 23
Condition100%3/3
not defined $bytes or ref $bytes
l!l&&r!l&&!r
1220
MC/DC100%2/2
not defined $bytes or ref $bytes
not defined $bytes ref $bytes
Truth table100%3/3
not(A) or B
A= not defined $bytesB= ref $bytes
ABresult
1X1
011
000
13 if (!defined($bytes)||ref($bytes));
14 20 ▶ die "D1 blob requires bytes, not wide characters\n"
Branch: 1 branch
BranchTrueFalseTotal
unless utf8::downgrade($bytes, 1) 1 19 20
15 unless utf8::downgrade($bytes, 1);
16 19 my $self=bless({ bytes => $bytes }, $class);
17 19 return $self;
18 }
19  
20  
21 0 ▶sub bytes {
Subroutine bytes: not called CC=1 SCAR=6.9
Pod undocumented
22 0 return shift()->{'bytes'};
23 }
24  
25  
26 27 ▶sub wire_value {
Subroutine wire_value: called CC=1 SCAR=0.0
Pod undocumented
27 27 my ($self)=@_;
28 return {
29 type => 'blob',
30 27 base64 => encode_base64($self->{'bytes'}, ''),
31 };
32 }
33  
34 5 1;
« blib/lib/WebDyne/Cloudflare/R2/Blob.pm ↑ Summary blib/lib/WebDyne/Cloudflare/SecretsStore/Error.pm »