lib/App/ElasticSearch/Utilities/QueryString/Underscored.pm

filter: Statementstmt 100% 28 / 28 Branchbran 75.0% 3 / 4 Conditioncond 50.0% 3 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 84.3% 43 / 51 CC 5 SCAR 7.4
CC
5
Cov
89%
__ANON__
3.3
handle_token
3.0
BEGIN
1.0
CRAP 2.1
« lib/App/ElasticSearch/Utilities/QueryString/IP.pm ↑ Summary script/es-aggregate.pl »
1 package App::ElasticSearch::Utilities::QueryString::Underscored;
2 # ABSTRACT: Extend some _<type>_ queries
3  
4 2 ▶use v5.16;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = '9.1'; # VERSION
8  
9 2 ▶use CLI::Helpers qw(:output);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 with 'App::ElasticSearch::Utilities::QueryString::Plugin';
14  
15 1 ▶sub _build_priority { 20; }
Subroutine _build_priority: called CC=1 SCAR=0.0
16  
17 my %Underscored = (
18 2 ▶ _prefix_ => sub {
Subroutine __ANON__: called CC=3 SCAR=12.0
19 2 my ($v) = @_;
20 2 my ($field,$text) = split /[:=]/, $v, 2;
21  
22 2 ▶ return unless defined $text and length $text;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $text and length $text 0 2 2
Condition33%1/3
defined $text and length $text
!ll&&!rl&&r
002
MC/DC0%0/2
defined $text and length $text
defined $text length $text
Truth table33%1/3
A and B
A= defined $textB= length $text
ABresult
0X0
100
111
23 2 return { condition => { prefix => { $field => $text } } }
24 },
25 1 );
26  
27  
28 7 ▶sub handle_token {
Subroutine handle_token: called CC=3 SCAR=11.0
Pod undocumented
29 7 my ($self,$token) = @_;
30  
31 7 debug(sprintf "%s - evaluating token '%s'", $self->name, $token);
32 7 my ($k,$v) = split /:/, $token, 2;
33  
34 7 ▶ return unless exists $Underscored{lc $k} and defined $v;
Branch: 1 branch
BranchTrueFalseTotal
unless exists $Underscored{lc $k} and defined $v 5 2 7
Condition66%2/3
exists $Underscored{lc $k} and defined $v
!ll&&!rl&&r
502
MC/DC50%1/2
exists $Underscored{lc $k} and defined $v
exists $Underscored{lc $k} defined $v
Truth table66%2/3
A and B
A= exists $Underscored{lc $k}B= defined $v
ABresult
0X0
100
111
35  
36 2 return $Underscored{lc $k}->($v);
37 }
38  
39 # Return True;
40 1 1;
41  
42 __END__
« lib/App/ElasticSearch/Utilities/QueryString/IP.pm ↑ Summary script/es-aggregate.pl »