blib/lib/Thunderhorse/Request.pm

filter: Statementstmt 100% 30 / 30 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 66.6% 2 / 3 totaltotal 90.0% 45 / 50 CC 4 SCAR 5.5
CC
4
Cov
95%
path_params
3.0
FOREIGNBUILDARGS
2.1
BEGIN
1.0
CRAP 1.7
« bin/thunderhorse ↑ Summary blib/lib/Thunderhorse/Controller.pm »
1 package Thunderhorse::Request;
2 24 $Thunderhorse::Request::VERSION = '0.107';
3 24 ▶use v5.40;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 24 ▶use Mooish::Base -standard;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 24 ▶use Future::AsyncAwait;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 24 ▶use Gears::X::Thunderhorse;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 24 ▶use List::Util qw(mesh);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 24 extends 'PAGI::Request';
11 24 with 'Thunderhorse::Message';
12  
13 106 ▶sub FOREIGNBUILDARGS ($class, %args)
Subroutine FOREIGNBUILDARGS: called CC=2 SCAR=7.2
Pod undocumented
14 {
15 Gears::X::Thunderhorse->raise('no context for response')
16 106 ▶ unless $args{context};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"context"} 0 106 106
17  
18 106 return $args{context}->pagi->@[0, 1];
19 }
20  
21 106 ▶sub update ($self, $scope, $receive, $send)
Subroutine update: called CC=1 SCAR=0.0
Pod documented
22 {
23 106 $self->{scope} = $scope;
24 106 $self->{receive} = $receive;
25  
26 # handling next match, so make sure path_params are invalidated
27 106 delete $self->{path_params};
28 }
29  
30 6 ▶sub path_params ($self)
Subroutine path_params: called CC=3 SCAR=11.0
Pod documented
31 {
32 6 ▶ return $self->{path_params} //= do {
Condition66%2/3
$self->{"path_params"} //= do { my $ctx = $self->context; my $match = $ctx->match; $match = $match->[0] if ref $match eq "ARRAY"; my $pattern = $match->location->pattern_obj; my $matched = $match->matched; +{mesh([map({$_->{"label"};} @{$pattern->tokens})], $matched)} }
l!l&&r!l&&!r
420
MC/DC0%0/2
$self->{"path_params"} //= do { my $ctx = $self->context; my $match = $ctx->match; $match = $match->[0] if ref $match eq "ARRAY"; my $pattern = $match->location->pattern_obj; my $matched = $match->matched; +{mesh([map({$_->{"label"};} @{$pattern->tokens})], $matched)} }
$self->{"path_params"} do { my $ctx = $self->context; my $match = $ctx->match; $match = $match->[0] if ref $match eq "ARRAY"; my $pattern = $match->location->pattern_obj; my $matched = $match->matched; +{mesh([map({$_->{"label"};} @{$pattern->tokens})], $matched)} }
Truth table66%2/3
A //= B
A= $self->{"path_params"}B= do { my $ctx = $self->context; my $match = $ctx->match; $match = $match->[0] if ref $match eq "ARRAY"; my $pattern = $match->location->pattern_obj; my $matched = $match->matched; +{mesh([map({$_->{"label"};} @{$pattern->tokens})], $matched)} }
ABresult
1X1
011
000
33 2 my $ctx = $self->context;
34 2 my $match = $ctx->match;
35 2 ▶ $match = $match->[0]
Branch: 1 branch
BranchTrueFalseTotal
if ref $match eq "ARRAY" 1 1 2
36 if ref $match eq 'ARRAY';
37  
38 2 my $pattern = $match->location->pattern_obj;
39 2 my $matched = $match->matched;
40 2 +{mesh [map { $_->{label} } $pattern->tokens->@*], $matched};
41 };
42 }
43  
44 __END__
« bin/thunderhorse ↑ Summary blib/lib/Thunderhorse/Controller.pm »