line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
27
|
|
|
27
|
|
941
|
use strict; |
|
27
|
|
|
|
|
71
|
|
|
27
|
|
|
|
|
1947
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::FormFu::Constraint::Number; |
4
|
|
|
|
|
|
|
$HTML::FormFu::Constraint::Number::VERSION = '2.07'; |
5
|
|
|
|
|
|
|
# ABSTRACT: Numerical Constraint |
6
|
|
|
|
|
|
|
|
7
|
27
|
|
|
27
|
|
185
|
use Moose; |
|
27
|
|
|
|
|
68
|
|
|
27
|
|
|
|
|
235
|
|
8
|
|
|
|
|
|
|
extends 'HTML::FormFu::Constraint'; |
9
|
|
|
|
|
|
|
|
10
|
27
|
|
|
27
|
|
195314
|
use Scalar::Util qw( looks_like_number ); |
|
27
|
|
|
|
|
74
|
|
|
27
|
|
|
|
|
5204
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub constrain_value { |
13
|
77
|
|
|
77
|
0
|
212
|
my ( $self, $value ) = @_; |
14
|
|
|
|
|
|
|
|
15
|
77
|
100
|
100
|
|
|
488
|
return 1 if !defined $value || $value eq ''; |
16
|
|
|
|
|
|
|
|
17
|
74
|
|
|
|
|
328
|
my $ok = looks_like_number($value); |
18
|
|
|
|
|
|
|
|
19
|
74
|
50
|
|
|
|
2270
|
return $self->not ? !$ok : $ok; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
__END__ |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=encoding UTF-8 |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
HTML::FormFu::Constraint::Number - Numerical Constraint |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 VERSION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
version 2.07 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 DESCRIPTION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
The input must be a number. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SEE ALSO |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Is a sub-class of, and inherits methods from L<HTML::FormFu::Constraint> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
L<HTML::FormFu> |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 AUTHOR |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Carl Franks C<cfranks@cpan.org> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 LICENSE |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
57
|
|
|
|
|
|
|
the same terms as Perl itself. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 AUTHOR |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Carl Franks <cpan@fireartist.com> |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Carl Franks. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
68
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |