Data/Sah/Compiler/human/TH/Sortable.pm

filter: Statementstmt 100% 37 / 37 Branchbran 91.6% 11 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 3 totaltotal 93.4% 57 / 61 CC 7 SCAR 13.4
CC
7
Cov
98%
superclause_sortable
7.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.8
« Data/Sah/Compiler/perl/TH/cistr.pm ↑ Summary Test/Data/Sah/Human.pm »
1 package Data::Sah::Compiler::human::TH::Sortable;
2  
3 34 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 34 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 34 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 #use Log::Any '$log';
7  
8 34 ▶use Mo qw(build default);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 34 ▶use Role::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 34 ▶use Role::Tiny::With;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 34 with 'Data::Sah::Type::Sortable';
13  
14 34 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
15 34 our $DATE = '2024-02-16'; # DATE
16 34 our $DIST = 'Data-Sah'; # DIST
17 34 our $VERSION = '0.917'; # VERSION
18  
19 609 ▶sub before_clause_between {
Subroutine before_clause_between: called CC=1 SCAR=0.0
Pod undocumented
20 609 my ($self, $cd) = @_;
21 609 $cd->{CLAUSE_DO_MULTI} = 0;
22 }
23  
24 84 ▶sub before_clause_xbetween {
Subroutine before_clause_xbetween: called CC=1 SCAR=0.0
Pod undocumented
25 84 my ($self, $cd) = @_;
26 84 $cd->{CLAUSE_DO_MULTI} = 0;
27 }
28  
29 1417 ▶sub superclause_sortable {
Subroutine superclause_sortable: called CC=7 SCAR=19.5
Pod undocumented
30 1417 my ($self, $which, $cd) = @_;
31 1417 my $c = $self->compiler;
32 1417 my $cv = $cd->{cl_value};
33  
34 1417 ▶ if ($which eq 'min') {
Branch: 6 branches
BranchTrueFalseTotal
if ($which eq 'min') { } 187 1230 1417
elsif ($which eq 'xmin') { } 64 1166 1230
elsif ($which eq 'max') { } 119 1047 1166
elsif ($which eq 'xmax') { } 87 960 1047
elsif ($which eq 'between') { } 876 84 960
elsif ($which eq 'xbetween') { } 84 0 84
35 187 $c->add_ccl($cd, {
36 expr=>1,
37 fmt => '%(modal_verb)s be at least %s',
38 });
39 } elsif ($which eq 'xmin') {
40 64 $c->add_ccl($cd, {
41 expr=>1,
42 fmt => '%(modal_verb)s be larger than %s',
43 });
44 } elsif ($which eq 'max') {
45 119 $c->add_ccl($cd, {
46 expr=>1,
47 fmt => '%(modal_verb)s be at most %s',
48 });
49 } elsif ($which eq 'xmax') {
50 87 $c->add_ccl($cd, {
51 expr=>1,
52 fmt => '%(modal_verb)s be smaller than %s',
53 });
54 } elsif ($which eq 'between') {
55 876 $c->add_ccl($cd, {
56 fmt => '%(modal_verb)s be between %s and %s',
57 vals => $cv,
58 });
59 } elsif ($which eq 'xbetween') {
60 84 $c->add_ccl($cd, {
61 fmt => '%(modal_verb)s be larger than %s and smaller than %s',
62 vals => $cv,
63 });
64 }
65 }
66  
67 34 1;
68 # ABSTRACT: human's type handler for role "Sortable"
69  
70 __END__
« Data/Sah/Compiler/perl/TH/cistr.pm ↑ Summary Test/Data/Sah/Human.pm »