SDK/Core/SecretString.pm

filter: Statementstmt 100% 41 / 41 Branchbran 80.0% 8 / 10 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 14 / 14 Podpod 100% 2 / 2 totaltotal 94.4% 68 / 72 CC 8 SCAR 8.5
CC
8
Cov
94%
_constant_time_equals
5.0
equals
3.0
__ANON__
2.0
CRAP 2.3
« SDK/Storage/Tables/TransactionResult.pm ↑ Summary SDK/Core/Policy/Credential.pm »
1 20 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 20 ▶use feature 'class';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 20 ▶no warnings 'experimental::class';
Subroutine BEGIN: called CC=1 SCAR=0.0
4
5 20 class Azure::SDK::Core::SecretString {
6 20 ▶ use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 20 ▶ use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 use overload
9 3 ▶ '""' => sub { '[REDACTED]' },
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
10 1 ▶ 'bool' => sub { 1 },
Subroutine __ANON__: called CC=1 SCAR=0.0
11 2 ▶ 'eq' => sub { $_[0]->equals($_[1]) },
Subroutine __ANON__: called CC=1 SCAR=0.0
12 1 ▶ 'ne' => sub { !$_[0]->equals($_[1]) },
Subroutine __ANON__: called CC=1 SCAR=0.0
13 20 fallback => 1;
14
15 20 field $value :param = undef;
16
17 227 ▶ ADJUST {
Subroutine __ANON__: called CC=2 SCAR=6.9
18 227 ▶ croak 'Azure::SDK::Core::SecretString requires a value'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 1 226 227
19 unless defined $value;
20 }
21
22 201 ▶ method reveal () {
Subroutine reveal: called CC=1 SCAR=0.0
Pod documented
23 201 return $value;
24 }
25
26 6 ▶ method equals ($other) {
Subroutine equals: called CC=3 SCAR=11.1
Pod documented
27 6 ▶ return 0
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($other) and $other->isa("Azure::SDK::Core::SecretString") 2 4 6
Condition66%2/3
builtin::blessed($other) and $other->isa("Azure::SDK::Core::SecretString")
!ll&&!rl&&r
204
MC/DC50%1/2
builtin::blessed($other) and $other->isa("Azure::SDK::Core::SecretString")
builtin::blessed($other) $other->isa("Azure::SDK::Core::SecretString")
Truth table66%2/3
A and B
A= builtin::blessed($other)B= $other->isa("Azure::SDK::Core::SecretString")
ABresult
0X0
100
111
28 unless blessed($other)
29 && $other->isa('Azure::SDK::Core::SecretString');
30
31 4 return _constant_time_equals( $value, $other->reveal );
32 }
33
34 4 ▶ sub _constant_time_equals ( $left, $right ) {
Subroutine _constant_time_equals: called CC=5 SCAR=16.2
35 4 my $left_bytes = $left;
36 4 my $right_bytes = $right;
37 4 utf8::encode($left_bytes);
38 4 utf8::encode($right_bytes);
39
40 4 my $left_length = length $left_bytes;
41 4 my $right_length = length $right_bytes;
42 4 ▶ my $maximum_length = $left_length > $right_length ? $left_length : $right_length;
Branch: 1 branch
BranchTrueFalseTotal
$left_length > $right_length ? : 0 4 4
43 4 my $difference = $left_length ^ $right_length;
44
45 4 for my $index ( 0 .. $maximum_length - 1 ) {
46 40 ▶ my $left_octet = $index < $left_length
Branch: 1 branch
BranchTrueFalseTotal
$index < $left_length ? : 36 4 40
47 ? ord substr( $left_bytes, $index, 1 )
48 : 0;
49 40 ▶ my $right_octet = $index < $right_length
Branch: 1 branch
BranchTrueFalseTotal
$index < $right_length ? : 40 0 40
50 ? ord substr( $right_bytes, $index, 1 )
51 : 0;
52 40 $difference |= $left_octet ^ $right_octet;
53 }
54
55 4 return $difference == 0;
56 }
57 }
58
59 20 1;
60
61 __END__
« SDK/Storage/Tables/TransactionResult.pm ↑ Summary SDK/Core/Policy/Credential.pm »