line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
26
|
|
|
26
|
|
131
|
use strict; |
|
26
|
|
|
|
|
49
|
|
|
26
|
|
|
|
|
893
|
|
2
|
26
|
|
|
26
|
|
129
|
use warnings; |
|
26
|
|
|
|
|
50
|
|
|
26
|
|
|
|
|
905
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: a tolerance "m <= n" |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package |
6
|
|
|
|
|
|
|
Number::Tolerant::Type::or_less; |
7
|
26
|
|
|
26
|
|
124
|
use parent qw(Number::Tolerant::Type); |
|
26
|
|
|
|
|
45
|
|
|
26
|
|
|
|
|
141
|
|
8
|
|
|
|
|
|
|
|
9
|
14
|
|
|
14
|
1
|
18
|
sub construct { shift; { value => $_[0], max => $_[0] } } |
|
14
|
|
|
|
|
55
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub parse { |
12
|
27
|
|
|
27
|
1
|
53
|
my ($self, $string, $factory) = @_; |
13
|
|
|
|
|
|
|
|
14
|
27
|
|
|
|
|
128
|
my $number = $self->number_re; |
15
|
27
|
|
|
|
|
117
|
my $X = $self->variable_re; |
16
|
|
|
|
|
|
|
|
17
|
27
|
100
|
|
|
|
622
|
return $factory->new("$1", 'or_less') if $string =~ m!\A$X?<=\s*($number)\z!; |
18
|
26
|
100
|
|
|
|
630
|
return $factory->new("$1", 'or_less') if $string =~ m!\A($number)\s*>=$X\z!; |
19
|
25
|
100
|
|
|
|
576
|
return $factory->new("$1", 'or_less') |
20
|
|
|
|
|
|
|
if $string =~ m!\A($number)\s+or\s+less\z!; |
21
|
|
|
|
|
|
|
|
22
|
24
|
|
|
|
|
155
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub valid_args { |
26
|
93
|
|
|
93
|
1
|
165
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
93
|
100
|
|
|
|
156
|
return unless 2 == grep { defined } @_; |
|
204
|
|
|
|
|
670
|
|
29
|
42
|
100
|
|
|
|
199
|
return unless $_[1] eq 'or_less'; |
30
|
|
|
|
|
|
|
|
31
|
14
|
|
|
|
|
58
|
return $self->normalize_number($_[0]); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |