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   9130 use strict;
  21         61  
4 21     21   93 use warnings;
  21         34  
  21         495  
5 21     21   84 #use Log::Any '$log';
  21         34  
  21         529  
6              
7             use Mo qw(build default);
8 21     21   88 use Role::Tiny;
  21         35  
  21         107  
9 21     21   4894 use Role::Tiny::With;
  21         39  
  21         100  
10 21     21   2886  
  21         52  
  21         6294  
11             with 'Data::Sah::Type::Sortable';
12              
13             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
14             our $DATE = '2022-08-20'; # DATE
15             our $DIST = 'Data-Sah'; # DIST
16             our $VERSION = '0.912'; # VERSION
17              
18             my ($self, $cd) = @_;
19             $cd->{CLAUSE_DO_MULTI} = 0;
20 609     609 0 1501 }
21 609         1572  
22             my ($self, $cd) = @_;
23             $cd->{CLAUSE_DO_MULTI} = 0;
24             }
25 84     84 0 244  
26 84         208 my ($self, $which, $cd) = @_;
27             my $c = $self->compiler;
28             my $cv = $cd->{cl_value};
29              
30 1417     1417 0 3707 if ($which eq 'min') {
31 1417         4260 $c->add_ccl($cd, {
32 1417         6217 expr=>1,
33             fmt => '%(modal_verb)s be at least %s',
34 1417 100       7269 });
    100          
    100          
    100          
    100          
    50          
35 187         928 } elsif ($which eq 'xmin') {
36             $c->add_ccl($cd, {
37             expr=>1,
38             fmt => '%(modal_verb)s be larger than %s',
39             });
40 64         340 } elsif ($which eq 'max') {
41             $c->add_ccl($cd, {
42             expr=>1,
43             fmt => '%(modal_verb)s be at most %s',
44             });
45 119         516 } elsif ($which eq 'xmax') {
46             $c->add_ccl($cd, {
47             expr=>1,
48             fmt => '%(modal_verb)s be smaller than %s',
49             });
50 87         394 } 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         4015 } 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         404 }
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.912 of Data::Sah::Compiler::human::TH::Sortable (from Perl distribution Data-Sah), released on 2022-08-20.
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