line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Apache::Voodoo::Validate::unsigned_decimal; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = "3.0200"; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1648
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use base("Apache::Voodoo::Validate::Plugin"); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
768
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub config { |
11
|
0
|
|
|
0
|
0
|
|
my ($self,$c) = @_; |
12
|
0
|
|
|
|
|
|
my @e; |
13
|
0
|
0
|
|
|
|
|
if (defined($c->{left})) { |
14
|
0
|
0
|
|
|
|
|
if ($c->{left} =~ /^\d+$/) { |
15
|
0
|
|
|
|
|
|
$self->{left} = $c->{left}; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
else { |
18
|
0
|
|
|
|
|
|
push(@e,"'left' must be positive integer"); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
else { |
22
|
0
|
|
|
|
|
|
push(@e,"'left' must be positive integer"); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
if (defined($c->{right})) { |
26
|
0
|
0
|
|
|
|
|
if ($c->{right} =~ /^\d+$/) { |
27
|
0
|
|
|
|
|
|
$self->{right} = $c->{right}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
else { |
30
|
0
|
|
|
|
|
|
push(@e,"'right' must be positive integer"); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
else { |
34
|
0
|
|
|
|
|
|
push(@e,"'right' must be positive integer"); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
return @e; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub valid { |
41
|
0
|
|
|
0
|
0
|
|
my ($self,$v) = @_; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my $e; |
44
|
0
|
0
|
|
|
|
|
if ($v =~ /^(\d*)(?:\.(\d+))?$/) { |
45
|
0
|
|
0
|
|
|
|
my $l = $2 || 0; |
46
|
0
|
|
0
|
|
|
|
my $r = $3 || 0; |
47
|
0
|
|
|
|
|
|
$l *= 1; |
48
|
0
|
|
|
|
|
|
$r *= 1; |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
0
|
|
|
|
if (length($l) > $self->{'left'} || |
51
|
|
|
|
|
|
|
length($r) > $self->{'right'} ) { |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
$e='BIG'; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
else { |
57
|
0
|
|
|
|
|
|
$e='BAD'; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
return $v,$e; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
################################################################################ |
66
|
|
|
|
|
|
|
# Copyright (c) 2005-2010 Steven Edwards (maverick@smurfbane.org). |
67
|
|
|
|
|
|
|
# All rights reserved. |
68
|
|
|
|
|
|
|
# |
69
|
|
|
|
|
|
|
# You may use and distribute Apache::Voodoo under the terms described in the |
70
|
|
|
|
|
|
|
# LICENSE file include in this package. The summary is it's a legalese version |
71
|
|
|
|
|
|
|
# of the Artistic License :) |
72
|
|
|
|
|
|
|
# |
73
|
|
|
|
|
|
|
################################################################################ |