File Coverage

blib/lib/Data/Sah/Compiler/human/TH/bool.pm
Criterion Covered Total %
statement 24 28 85.7
branch 2 2 100.0
condition n/a
subroutine 9 10 90.0
pod 0 5 0.0
total 35 45 77.7


line stmt bran cond sub pod time code
1              
2             use 5.010;
3 3     3   45 use strict;
  3         9  
4 3     3   12 use warnings;
  3         6  
  3         63  
5 3     3   10 #use Log::Any '$log';
  3         6  
  3         79  
6              
7             use Mo qw(build default);
8 3     3   19 use Role::Tiny::With;
  3         12  
  3         16  
9 3     3   640  
  3         6  
  3         872  
10             extends 'Data::Sah::Compiler::human::TH';
11             with 'Data::Sah::Compiler::human::TH::Comparable';
12             with 'Data::Sah::Compiler::human::TH::Sortable';
13             with 'Data::Sah::Type::bool';
14              
15             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
16             our $DATE = '2022-08-20'; # DATE
17             our $DIST = 'Data-Sah'; # DIST
18             our $VERSION = '0.912'; # VERSION
19              
20              
21 355     355 0 1218 my ($self, $cd) = @_;
22             my $c = $self->compiler;
23              
24 355     355 0 641 $c->add_ccl($cd, {
25 355         1066 fmt => ["boolean value", "boolean values"],
26             type => 'noun',
27 355         2379 });
28             }
29              
30             my ($self, $cd) = @_;
31             $cd->{CLAUSE_DO_MULTI} = 0;
32             }
33              
34 21     21 0 31 my ($self, $cd) = @_;
35 21         43 my $c = $self->compiler;
36             my $cv = $cd->{cl_value};
37              
38             $c->add_ccl($cd, {
39 21     21 0 35 fmt => $cv ? q[%(modal_verb)s be true] : q[%(modal_verb)s be false],
40 21         57 });
41 21         80 }
42              
43 21 100       83 my ($self, $cd) = @_;
44             my $c = $self->compiler;
45             my $cv = $cd->{cl_value};
46              
47             $c->add_ccl($cd, {
48             fmt => q[%(modal_verb)s be a regex pattern],
49 0     0 0   });
50 0           }
51 0            
52             1;
53 0           # ABSTRACT: perl's type handler for type "bool"
54              
55              
56             =pod
57              
58             =encoding UTF-8
59              
60             =head1 NAME
61              
62             Data::Sah::Compiler::human::TH::bool - perl's type handler for type "bool"
63              
64             =head1 VERSION
65              
66             This document describes version 0.912 of Data::Sah::Compiler::human::TH::bool (from Perl distribution Data-Sah), released on 2022-08-20.
67              
68             =for Pod::Coverage ^(name|clause_.+|superclause_.+|before_.+|after_.+)$
69              
70             =head1 HOMEPAGE
71              
72             Please visit the project's homepage at L<https://metacpan.org/release/Data-Sah>.
73              
74             =head1 SOURCE
75              
76             Source repository is at L<https://github.com/perlancar/perl-Data-Sah>.
77              
78             =head1 AUTHOR
79              
80             perlancar <perlancar@cpan.org>
81              
82             =head1 CONTRIBUTING
83              
84              
85             To contribute, you can send patches by email/via RT, or send pull requests on
86             GitHub.
87              
88             Most of the time, you don't need to build the distribution yourself. You can
89             simply modify the code, then test via:
90              
91             % prove -l
92              
93             If you want to build the distribution (e.g. to try to install it locally on your
94             system), you can install L<Dist::Zilla>,
95             L<Dist::Zilla::PluginBundle::Author::PERLANCAR>,
96             L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
97             Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond
98             that are considered a bug and can be reported to me.
99              
100             =head1 COPYRIGHT AND LICENSE
101              
102             This software is copyright (c) 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar <perlancar@cpan.org>.
103              
104             This is free software; you can redistribute it and/or modify it under
105             the same terms as the Perl 5 programming language system itself.
106              
107             =head1 BUGS
108              
109             Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah>
110              
111             When submitting a bug or request, please include a test-file or a
112             patch to an existing test-file that illustrates the bug or desired
113             feature.
114              
115             =cut