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   508 use strict;
  4         13  
4 4     4   17 use warnings;
  4         7  
  4         69  
5 4     4   14 #use Log::Any '$log';
  4         8  
  4         104  
6              
7             use Mo qw(build default);
8 4     4   20 use Role::Tiny::With;
  4         7  
  4         17  
9 4     4   1006  
  4         13  
  4         1975  
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-08-20'; # DATE
17             our $DIST = 'Data-Sah'; # DIST
18             our $VERSION = '0.912'; # VERSION
19              
20              
21 666     666 0 3035 my ($self, $cd) = @_;
22             my $c = $self->compiler;
23              
24 667     667 0 1603 $c->add_ccl($cd, {
25 667         2617 type=>'noun',
26             fmt => ["decimal number", "decimal numbers"],
27 667         5152 });
28             }
29              
30             my ($self, $cd) = @_;
31             my $c = $self->compiler;
32              
33             my $cv = $cd->{cl_value};
34 19     19 0 29 if ($cd->{cl_is_expr}) {
35 19         45 $c->add_ccl($cd, {});
36             } else {
37 19         80 $c->add_ccl($cd, {
38 19 50       39 fmt => $cv ?
39 0         0 q[%(modal_verb)s be a NaN] :
40             q[%(modal_verb_neg)s be a NaN],
41 19 100       67 });
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 44 $c->add_ccl($cd, {});
51 28         63 } else {
52             $c->add_ccl($cd, {
53 28         109 fmt => $cv ?
54 28 50       52 q[%(modal_verb)s an infinity] :
55 0         0 q[%(modal_verb_neg)s an infinity],
56             });
57 28 100       98 }
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 56 } else {
67 28         64 $c->add_ccl($cd, {
68             fmt => $cv ?
69 28         114 q[%(modal_verb)s a positive infinity] :
70 28 50       48 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 49 $c->add_ccl($cd, {
83 28         70 fmt => $cv ?
84             q[%(modal_verb)s a negative infinity] :
85 28         105 q[%(modal_verb_neg)s a negative infinity],
86 28 50       54 });
87 0         0 }
88             }
89 28 100       101  
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.912 of Data::Sah::Compiler::human::TH::float (from Perl distribution Data-Sah), released on 2022-08-20.
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