line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
26
|
|
|
26
|
|
137
|
use strict; |
|
26
|
|
|
|
|
38
|
|
|
26
|
|
|
|
|
724
|
|
2
|
26
|
|
|
26
|
|
102
|
use warnings; |
|
26
|
|
|
|
|
44
|
|
|
26
|
|
|
|
|
697
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: a tolerance "m <= n" |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package |
6
|
|
|
|
|
|
|
Number::Tolerant::Type::or_less; |
7
|
26
|
|
|
26
|
|
128
|
use parent qw(Number::Tolerant::Type); |
|
26
|
|
|
|
|
39
|
|
|
26
|
|
|
|
|
96
|
|
8
|
|
|
|
|
|
|
|
9
|
14
|
|
|
14
|
1
|
19
|
sub construct { shift; { value => $_[0], max => $_[0] } } |
|
14
|
|
|
|
|
39
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub parse { |
12
|
18
|
|
|
18
|
1
|
34
|
my ($self, $string, $factory) = @_; |
13
|
|
|
|
|
|
|
|
14
|
18
|
|
|
|
|
55
|
my $number = $self->number_re; |
15
|
18
|
|
|
|
|
46
|
my $X = $self->variable_re; |
16
|
|
|
|
|
|
|
|
17
|
18
|
100
|
|
|
|
211
|
return $factory->new("$1", 'or_less') if $string =~ m!\A$X?<=\s*($number)\z!; |
18
|
17
|
100
|
|
|
|
254
|
return $factory->new("$1", 'or_less') if $string =~ m!\A($number)\s*>=$X\z!; |
19
|
16
|
100
|
|
|
|
196
|
return $factory->new("$1", 'or_less') |
20
|
|
|
|
|
|
|
if $string =~ m!\A($number)\s+or\s+less\z!; |
21
|
|
|
|
|
|
|
|
22
|
15
|
|
|
|
|
47
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub valid_args { |
26
|
62
|
|
|
62
|
1
|
78
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
62
|
100
|
|
|
|
86
|
return unless 2 == grep { defined } @_; |
|
145
|
|
|
|
|
269
|
|
29
|
25
|
100
|
|
|
|
53
|
return unless $_[1] eq 'or_less'; |
30
|
|
|
|
|
|
|
|
31
|
14
|
|
|
|
|
41
|
return $self->normalize_number($_[0]); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |