line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
26
|
|
|
26
|
|
135
|
use strict; |
|
26
|
|
|
|
|
45
|
|
|
26
|
|
|
|
|
638
|
|
2
|
26
|
|
|
26
|
|
99
|
use warnings; |
|
26
|
|
|
|
|
46
|
|
|
26
|
|
|
|
|
700
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: a tolerance "m < n" |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package |
6
|
|
|
|
|
|
|
Number::Tolerant::Type::less_than; |
7
|
26
|
|
|
26
|
|
105
|
use parent qw(Number::Tolerant::Type); |
|
26
|
|
|
|
|
41
|
|
|
26
|
|
|
|
|
140
|
|
8
|
|
|
|
|
|
|
|
9
|
9
|
|
|
9
|
1
|
12
|
sub construct { shift; { value => $_[0], max => $_[0], exclude_max => 1 } } |
|
9
|
|
|
|
|
25
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub parse { |
12
|
23
|
|
|
23
|
1
|
40
|
my ($self, $string, $factory) = @_; |
13
|
|
|
|
|
|
|
|
14
|
23
|
|
|
|
|
74
|
my $number = $self->number_re; |
15
|
23
|
|
|
|
|
254
|
my $X = $self->variable_re; |
16
|
23
|
100
|
|
|
|
296
|
return $factory->new(less_than => "$1") if $string =~ m!\A$X?<\s*($number)\z!; |
17
|
22
|
100
|
|
|
|
289
|
return $factory->new(less_than => "$1") if $string =~ m!\A($number)\s*>$X\z!; |
18
|
|
|
|
|
|
|
|
19
|
21
|
100
|
|
|
|
207
|
return $factory->new(less_than => "$1") |
20
|
|
|
|
|
|
|
if $string =~ m!\Aless\s+than\s+($number)\z!; |
21
|
|
|
|
|
|
|
|
22
|
20
|
|
|
|
|
64
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub valid_args { |
26
|
79
|
|
|
79
|
1
|
110
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
79
|
100
|
|
|
|
113
|
return unless 2 == grep { defined } @_; |
|
182
|
|
|
|
|
354
|
|
29
|
|
|
|
|
|
|
|
30
|
37
|
|
|
|
|
78
|
for my $i ( [0,1], [1,0] ) { |
31
|
70
|
100
|
66
|
|
|
169
|
if ( |
32
|
|
|
|
|
|
|
$_[ $i->[0] ] eq 'less_than' |
33
|
|
|
|
|
|
|
and defined (my $num = $self->normalize_number($_[ $i->[1] ])) |
34
|
|
|
|
|
|
|
) { |
35
|
9
|
|
|
|
|
28
|
return $num; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
28
|
|
|
|
|
74
|
return; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |