line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
26
|
|
|
26
|
|
186
|
use strict; |
|
26
|
|
|
|
|
47
|
|
|
26
|
|
|
|
|
788
|
|
2
|
26
|
|
|
26
|
|
124
|
use warnings; |
|
26
|
|
|
|
|
52
|
|
|
26
|
|
|
|
|
912
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: a tolerance "m < n" |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package |
6
|
|
|
|
|
|
|
Number::Tolerant::Type::less_than; |
7
|
26
|
|
|
26
|
|
125
|
use parent qw(Number::Tolerant::Type); |
|
26
|
|
|
|
|
45
|
|
|
26
|
|
|
|
|
130
|
|
8
|
|
|
|
|
|
|
|
9
|
9
|
|
|
9
|
1
|
11
|
sub construct { shift; { value => $_[0], max => $_[0], exclude_max => 1 } } |
|
9
|
|
|
|
|
41
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub parse { |
12
|
26
|
|
|
26
|
1
|
56
|
my ($self, $string, $factory) = @_; |
13
|
|
|
|
|
|
|
|
14
|
26
|
|
|
|
|
127
|
my $number = $self->number_re; |
15
|
26
|
|
|
|
|
121
|
my $X = $self->variable_re; |
16
|
26
|
100
|
|
|
|
619
|
return $factory->new(less_than => "$1") if $string =~ m!\A$X?<\s*($number)\z!; |
17
|
25
|
100
|
|
|
|
601
|
return $factory->new(less_than => "$1") if $string =~ m!\A($number)\s*>$X\z!; |
18
|
|
|
|
|
|
|
|
19
|
24
|
100
|
|
|
|
459
|
return $factory->new(less_than => "$1") |
20
|
|
|
|
|
|
|
if $string =~ m!\Aless\s+than\s+($number)\z!; |
21
|
|
|
|
|
|
|
|
22
|
23
|
|
|
|
|
138
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub valid_args { |
26
|
69
|
|
|
69
|
1
|
103
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
69
|
100
|
|
|
|
115
|
return unless 2 == grep { defined } @_; |
|
154
|
|
|
|
|
476
|
|
29
|
|
|
|
|
|
|
|
30
|
36
|
|
|
|
|
101
|
for my $i ( [0,1], [1,0] ) { |
31
|
68
|
100
|
66
|
|
|
269
|
if ( |
32
|
|
|
|
|
|
|
$_[ $i->[0] ] eq 'less_than' |
33
|
|
|
|
|
|
|
and defined (my $num = $self->normalize_number($_[ $i->[1] ])) |
34
|
|
|
|
|
|
|
) { |
35
|
9
|
|
|
|
|
44
|
return $num; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
27
|
|
|
|
|
142
|
return; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |