| 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
| |||||||||||||||||||||||||||||
| 15 | unless ref $policies eq 'ARRAY'; | ||||||||||||||||||||||||||||
| 16 | 99 | ▶ | croak 'Azure::SDK::Core::Pipeline requires a transport' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $transport and $transport->can("send")
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")
| |||||||||||||||||||||||||||||
| 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
MC/DC0%0/2
$chain //= $self->_build_chain
$chain
$self->_build_chain
Truth table66%2/3
A //= B
A= $chainB= $self->_build_chain
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||