SDK/Core/Pipeline.pm

filter: Statementstmt 100% 28 / 28 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 9 / 9 Podpod 100% 1 / 1 totaltotal 82.6% 43 / 52 CC 6 SCAR 9.4
CC
6
Cov
87%
__ANON__
5.4
send
2.0
_build_chain
2.0
CRAP 2.5
« SDK/Core/Page.pm ↑ Summary SDK/Core/Policy/Diagnostics.pm »
1 17 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 17 ▶use feature 'class';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 17 ▶no warnings 'experimental::class';
Subroutine BEGIN: called CC=1 SCAR=0.0
4
5 17 class Azure::SDK::Core::Pipeline {
6 17 ▶ use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 17 field $policies :param :reader = [];
9 17 field $transport :param :reader = undef;
10
11 17 field $chain = undef;
12
13 99 ▶ ADJUST {
Subroutine __ANON__: called CC=4 SCAR=16.9
14 99 ▶ croak 'Azure::SDK::Core::Pipeline requires an arrayref of policies'
Branch: 1 branch
BranchTrueFalseTotal
unless ref $policies eq "ARRAY" 0 99 99
15 unless ref $policies eq 'ARRAY';
16 99 ▶ croak 'Azure::SDK::Core::Pipeline requires a transport'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $transport and $transport->can("send") 0 99 99
Condition33%1/3
defined $transport and $transport->can("send")
!ll&&!rl&&r
0099
MC/DC0%0/2
defined $transport and $transport->can("send")
defined $transport $transport->can("send")
Truth table33%1/3
A and B
A= defined $transportB= $transport->can("send")
ABresult
0X0
100
111
17 unless defined $transport && $transport->can('send');
18 }
19
20 140 ▶ method send ($context, $request) {
Subroutine send: called CC=2 SCAR=7.1
Pod documented
21 140 ▶ $chain //= $self->_build_chain;
Condition66%2/3
$chain //= $self->_build_chain
l!l&&r!l&&!r
41990
MC/DC0%0/2
$chain //= $self->_build_chain
$chain $self->_build_chain
Truth table66%2/3
A //= B
A= $chainB= $self->_build_chain
ABresult
1X1
011
000
22 140 return $chain->($context, $request);
23 }
24
25 # Composes the policies and transport into a single nested continuation once;
26 # the chain is reused across every send.
27 99 ▶ method _build_chain () {
Subroutine _build_chain: called CC=2 SCAR=6.9
28 99 my $transport_ref = $transport;
29 174 ▶ my $next = sub ($ctx, $req) {
Subroutine __ANON__: called CC=1 SCAR=0.0
30 174 return $transport_ref->send($req);
31 99 };
32
33 99 for my $policy ( reverse $policies->@* ) {
34 388 my $inner = $next;
35 605 ▶ $next = sub ($ctx, $req) {
Subroutine __ANON__: called CC=1 SCAR=0.0
36 605 return $policy->send($ctx, $req, $inner);
37 388 };
38 }
39
40 99 return $next;
41 }
42 }
43
44 17 1;
45
46 __END__
« SDK/Core/Page.pm ↑ Summary SDK/Core/Policy/Diagnostics.pm »