File Coverage

blib/lib/Data/Sah/Compiler/human/TH/Sortable.pm
Criterion Covered Total %
statement 31 31 100.0
branch 11 12 91.6
condition n/a
subroutine 9 9 100.0
pod 0 3 0.0
total 51 55 92.7


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