line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormFu::Constraint::Number; |
2
|
|
|
|
|
|
|
|
3
|
26
|
|
|
26
|
|
919
|
use strict; |
|
26
|
|
|
|
|
41
|
|
|
26
|
|
|
|
|
1241
|
|
4
|
|
|
|
|
|
|
our $VERSION = '2.05'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
26
|
|
|
26
|
|
100
|
use Moose; |
|
26
|
|
|
|
|
32
|
|
|
26
|
|
|
|
|
347
|
|
7
|
|
|
|
|
|
|
extends 'HTML::FormFu::Constraint'; |
8
|
|
|
|
|
|
|
|
9
|
26
|
|
|
26
|
|
115364
|
use Scalar::Util qw( looks_like_number ); |
|
26
|
|
|
|
|
37
|
|
|
26
|
|
|
|
|
3683
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub constrain_value { |
12
|
75
|
|
|
75
|
0
|
99
|
my ( $self, $value ) = @_; |
13
|
|
|
|
|
|
|
|
14
|
75
|
100
|
100
|
|
|
406
|
return 1 if !defined $value || $value eq ''; |
15
|
|
|
|
|
|
|
|
16
|
72
|
|
|
|
|
244
|
my $ok = looks_like_number($value); |
17
|
|
|
|
|
|
|
|
18
|
72
|
50
|
|
|
|
2032
|
return $self->not ? !$ok : $ok; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__END__ |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
HTML::FormFu::Constraint::Number - Numerical Constraint |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 VERSION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
version 2.05 |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
The input must be a number. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SEE ALSO |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Is a sub-class of, and inherits methods from L<HTML::FormFu::Constraint> |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
L<HTML::FormFu> |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 AUTHOR |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Carl Franks C<cfranks@cpan.org> |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 LICENSE |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify it under |
52
|
|
|
|
|
|
|
the same terms as Perl itself. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |