line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FormValidator::LazyWay::Rule::Number; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
368141
|
use strict; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
261
|
|
4
|
8
|
|
|
8
|
|
43
|
use warnings; |
|
8
|
|
|
|
|
15
|
|
|
8
|
|
|
|
|
2780
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub range { |
7
|
5
|
|
|
5
|
1
|
19545
|
my $num = shift; |
8
|
5
|
|
|
|
|
7
|
my $args = shift; |
9
|
|
|
|
|
|
|
|
10
|
5
|
100
|
|
|
|
21
|
return 0 if $num > $args->{max}; |
11
|
4
|
100
|
|
|
|
15
|
return 0 if $num < $args->{min}; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
|
|
7
|
return 1; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
sub int { |
16
|
11
|
|
|
11
|
1
|
24806
|
my $num = shift; |
17
|
11
|
100
|
|
|
|
40
|
return 1 if $num eq '0'; |
18
|
10
|
100
|
|
|
|
66
|
return $num =~ /^[-+]?[1-9][0-9]*$/ ? 1 : 0 ; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
sub uint { |
21
|
15
|
|
|
15
|
1
|
24289
|
my $num = shift; |
22
|
15
|
100
|
|
|
|
49
|
return 1 if $num eq '0'; |
23
|
13
|
100
|
|
|
|
77
|
return $num =~ /^[1-9][0-9]*$/ ? 1 : 0 ; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub float { |
27
|
13
|
|
|
13
|
0
|
31019
|
my $num = shift; |
28
|
13
|
100
|
|
|
|
80
|
return $num =~ /^[-+]?([1-9][0-9]*|0)(\.[0-9]+)?$/ ? 1 : 0 ; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub ufloat { |
32
|
12
|
|
|
12
|
0
|
30114
|
my $num = shift; |
33
|
12
|
100
|
|
|
|
79
|
return $num =~ /^([1-9][0-9]*|0)(\.[0-9]+)?$/ ? 1 : 0 ; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
FormValidator::LazyWay::Rule::Number - Number Rule |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 DESCRIPTION |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 METHOD |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 range |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
range |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Number#range : |
51
|
|
|
|
|
|
|
min : 3 |
52
|
|
|
|
|
|
|
max : 10 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 int |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
integer |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 uint |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
unsigned integer |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 float |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
float |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 ufloat |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
unsigned float |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 AUTHOR |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Tomohiro Teranishi |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |