File Coverage

blib/lib/Data/Sah/Compiler/human/TH/float.pm
Criterion Covered Total %
statement 38 42 90.4
branch 12 16 75.0
condition n/a
subroutine 11 11 100.0
pod 0 6 0.0
total 61 75 81.3


line stmt bran cond sub pod time code
1              
2             use 5.010;
3 4     4   520 use strict;
  4         13  
4 4     4   18 use warnings;
  4         7  
  4         66  
5 4     4   18 #use Log::Any '$log';
  4         8  
  4         108  
6              
7             use Mo qw(build default);
8 4     4   19 use Role::Tiny::With;
  4         6  
  4         19  
9 4     4   1026  
  4         9  
  4         2030  
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::float';
14              
15             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
16             our $DATE = '2022-09-30'; # DATE
17             our $DIST = 'Data-Sah'; # DIST
18             our $VERSION = '0.913'; # VERSION
19              
20              
21 666     666 0 3595 my ($self, $cd) = @_;
22             my $c = $self->compiler;
23              
24 667     667 0 1732 $c->add_ccl($cd, {
25 667         2828 type=>'noun',
26             fmt => ["decimal number", "decimal numbers"],
27 667         6454 });
28             }
29              
30             my ($self, $cd) = @_;
31             my $c = $self->compiler;
32              
33             my $cv = $cd->{cl_value};
34 19     19 0 32 if ($cd->{cl_is_expr}) {
35 19         62 $c->add_ccl($cd, {});
36             } else {
37 19         75 $c->add_ccl($cd, {
38 19 50       40 fmt => $cv ?
39 0         0 q[%(modal_verb)s be a NaN] :
40             q[%(modal_verb_neg)s be a NaN],
41 19 100       70 });
42             }
43             }
44              
45             my ($self, $cd) = @_;
46             my $c = $self->compiler;
47              
48             my $cv = $cd->{cl_value};
49             if ($cd->{cl_is_expr}) {
50 28     28 0 46 $c->add_ccl($cd, {});
51 28         74 } else {
52             $c->add_ccl($cd, {
53 28         108 fmt => $cv ?
54 28 50       56 q[%(modal_verb)s an infinity] :
55 0         0 q[%(modal_verb_neg)s an infinity],
56             });
57 28 100       106 }
58             }
59              
60             my ($self, $cd) = @_;
61             my $c = $self->compiler;
62              
63             my $cv = $cd->{cl_value};
64             if ($cd->{cl_is_expr}) {
65             $c->add_ccl($cd, {});
66 28     28 0 51 } else {
67 28         70 $c->add_ccl($cd, {
68             fmt => $cv ?
69 28         115 q[%(modal_verb)s a positive infinity] :
70 28 50       53 q[%(modal_verb_neg)s a positive infinity],
71 0         0 });
72             }
73 28 100       98 }
74              
75             my ($self, $cd) = @_;
76             my $c = $self->compiler;
77              
78             my $cv = $cd->{cl_value};
79             if ($cd->{cl_is_expr}) {
80             $c->add_ccl($cd, {});
81             } else {
82 28     28 0 43 $c->add_ccl($cd, {
83 28         76 fmt => $cv ?
84             q[%(modal_verb)s a negative infinity] :
85 28         106 q[%(modal_verb_neg)s a negative infinity],
86 28 50       66 });
87 0         0 }
88             }
89 28 100       107  
90             1;
91             # ABSTRACT: human's type handler for type "num"
92              
93              
94             =pod
95              
96             =encoding UTF-8
97              
98             =head1 NAME
99              
100             Data::Sah::Compiler::human::TH::float - human's type handler for type "num"
101              
102             =head1 VERSION
103              
104             This document describes version 0.913 of Data::Sah::Compiler::human::TH::float (from Perl distribution Data-Sah), released on 2022-09-30.
105              
106             =for Pod::Coverage ^(name|clause_.+|superclause_.+)$
107              
108             =head1 HOMEPAGE
109              
110             Please visit the project's homepage at L<https://metacpan.org/release/Data-Sah>.
111              
112             =head1 SOURCE
113              
114             Source repository is at L<https://github.com/perlancar/perl-Data-Sah>.
115              
116             =head1 AUTHOR
117              
118             perlancar <perlancar@cpan.org>
119              
120             =head1 CONTRIBUTING
121              
122              
123             To contribute, you can send patches by email/via RT, or send pull requests on
124             GitHub.
125              
126             Most of the time, you don't need to build the distribution yourself. You can
127             simply modify the code, then test via:
128              
129             % prove -l
130              
131             If you want to build the distribution (e.g. to try to install it locally on your
132             system), you can install L<Dist::Zilla>,
133             L<Dist::Zilla::PluginBundle::Author::PERLANCAR>,
134             L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
135             Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond
136             that are considered a bug and can be reported to me.
137              
138             =head1 COPYRIGHT AND LICENSE
139              
140             This software is copyright (c) 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar <perlancar@cpan.org>.
141              
142             This is free software; you can redistribute it and/or modify it under
143             the same terms as the Perl 5 programming language system itself.
144              
145             =head1 BUGS
146              
147             Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah>
148              
149             When submitting a bug or request, please include a test-file or a
150             patch to an existing test-file that illustrates the bug or desired
151             feature.
152              
153             =cut