line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
26
|
|
|
26
|
|
155
|
use strict; |
|
26
|
|
|
|
|
49
|
|
|
26
|
|
|
|
|
756
|
|
2
|
26
|
|
|
26
|
|
130
|
use warnings; |
|
26
|
|
|
|
|
46
|
|
|
26
|
|
|
|
|
749
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: a tolerance "m < n" |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package |
6
|
|
|
|
|
|
|
Number::Tolerant::Type::less_than; |
7
|
26
|
|
|
26
|
|
127
|
use parent qw(Number::Tolerant::Type); |
|
26
|
|
|
|
|
50
|
|
|
26
|
|
|
|
|
103
|
|
8
|
|
|
|
|
|
|
|
9
|
9
|
|
|
9
|
1
|
26
|
sub construct { shift; { value => $_[0], max => $_[0], exclude_max => 1 } } |
|
9
|
|
|
|
|
29
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub parse { |
12
|
23
|
|
|
23
|
1
|
62
|
my ($self, $string, $factory) = @_; |
13
|
|
|
|
|
|
|
|
14
|
23
|
|
|
|
|
78
|
my $number = $self->number_re; |
15
|
23
|
|
|
|
|
66
|
my $X = $self->variable_re; |
16
|
23
|
100
|
|
|
|
347
|
return $factory->new(less_than => "$1") if $string =~ m!\A$X?<\s*($number)\z!; |
17
|
22
|
100
|
|
|
|
433
|
return $factory->new(less_than => "$1") if $string =~ m!\A($number)\s*>$X\z!; |
18
|
|
|
|
|
|
|
|
19
|
21
|
100
|
|
|
|
256
|
return $factory->new(less_than => "$1") |
20
|
|
|
|
|
|
|
if $string =~ m!\Aless\s+than\s+($number)\z!; |
21
|
|
|
|
|
|
|
|
22
|
20
|
|
|
|
|
82
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub valid_args { |
26
|
70
|
|
|
70
|
1
|
115
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
70
|
100
|
|
|
|
120
|
return unless 2 == grep { defined } @_; |
|
159
|
|
|
|
|
388
|
|
29
|
|
|
|
|
|
|
|
30
|
24
|
|
|
|
|
66
|
for my $i ( [0,1], [1,0] ) { |
31
|
44
|
100
|
66
|
|
|
134
|
if ( |
32
|
|
|
|
|
|
|
$_[ $i->[0] ] eq 'less_than' |
33
|
|
|
|
|
|
|
and defined (my $num = $self->normalize_number($_[ $i->[1] ])) |
34
|
|
|
|
|
|
|
) { |
35
|
9
|
|
|
|
|
32
|
return $num; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
15
|
|
|
|
|
53
|
return; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |