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

filter: Statementstmt 89.1% 33 / 37 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.0% 9 / 10 Podpod 0.0% 0 / 5 totaltotal 81.4% 44 / 54 CC 2 SCAR 2.4
CC
2
Cov
90%
clause_is_true
2.0
clause_is_re
2.0
BEGIN
1.0
CRAP 1.3
« Data/Sah/Type/hash.pm ↑ Summary Data/Sah/Lang.pm »
1 package Data::Sah::Compiler::human::TH::bool;
2  
3 4 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 #use Log::Any '$log';
7  
8 4 ▶use Mo qw(build default);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use Role::Tiny::With;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 extends 'Data::Sah::Compiler::human::TH';
12 4 with 'Data::Sah::Compiler::human::TH::Comparable';
13 4 with 'Data::Sah::Compiler::human::TH::Sortable';
14 4 with 'Data::Sah::Type::bool';
15  
16 4 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
17 4 our $DATE = '2024-02-16'; # DATE
18 4 our $DIST = 'Data-Sah'; # DIST
19 4 our $VERSION = '0.917'; # VERSION
20  
21 355 ▶sub name { "boolean value" }
Subroutine name: called CC=1 SCAR=0.0
Pod undocumented
22  
23 355 ▶sub handle_type {
Subroutine handle_type: called CC=1 SCAR=0.0
Pod undocumented
24 355 my ($self, $cd) = @_;
25 355 my $c = $self->compiler;
26  
27 355 $c->add_ccl($cd, {
28 fmt => ["boolean value", "boolean values"],
29 type => 'noun',
30 });
31 }
32  
33 21 ▶sub before_clause_is_true {
Subroutine before_clause_is_true: called CC=1 SCAR=0.0
Pod undocumented
34 21 my ($self, $cd) = @_;
35 21 $cd->{CLAUSE_DO_MULTI} = 0;
36 }
37  
38 21 ▶sub clause_is_true {
Subroutine clause_is_true: called CC=2 SCAR=6.9
Pod undocumented
39 21 my ($self, $cd) = @_;
40 21 my $c = $self->compiler;
41 21 my $cv = $cd->{cl_value};
42  
43 21 ▶ $c->add_ccl($cd, {
Branch: 1 branch
BranchTrueFalseTotal
$cv ? : 8 13 21
44 fmt => $cv ? q[%(modal_verb)s be true] : q[%(modal_verb)s be false],
45 });
46 }
47  
48 0 ▶sub clause_is_re {
Subroutine clause_is_re: not called CC=1 SCAR=6.9
Pod undocumented
49 0 my ($self, $cd) = @_;
50 0 my $c = $self->compiler;
51 0 my $cv = $cd->{cl_value};
52  
53 0 $c->add_ccl($cd, {
54 fmt => q[%(modal_verb)s be a regex pattern],
55 });
56 }
57  
58 4 1;
59 # ABSTRACT: perl's type handler for type "bool"
60  
61 __END__
« Data/Sah/Type/hash.pm ↑ Summary Data/Sah/Lang.pm »