line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
26
|
|
|
26
|
|
147
|
use strict; |
|
26
|
|
|
|
|
50
|
|
|
26
|
|
|
|
|
793
|
|
2
|
26
|
|
|
26
|
|
126
|
use warnings; |
|
26
|
|
|
|
|
45
|
|
|
26
|
|
|
|
|
768
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: a tolerance "m <= n" |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package |
6
|
|
|
|
|
|
|
Number::Tolerant::Type::or_less; |
7
|
26
|
|
|
26
|
|
125
|
use parent qw(Number::Tolerant::Type); |
|
26
|
|
|
|
|
85
|
|
|
26
|
|
|
|
|
115
|
|
8
|
|
|
|
|
|
|
|
9
|
14
|
|
|
14
|
1
|
20
|
sub construct { shift; { value => $_[0], max => $_[0] } } |
|
14
|
|
|
|
|
40
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub parse { |
12
|
29
|
|
|
29
|
1
|
73
|
my ($self, $string, $factory) = @_; |
13
|
|
|
|
|
|
|
|
14
|
29
|
|
|
|
|
135
|
my $number = $self->number_re; |
15
|
29
|
|
|
|
|
91
|
my $X = $self->variable_re; |
16
|
|
|
|
|
|
|
|
17
|
29
|
100
|
|
|
|
519
|
return $factory->new("$1", 'or_less') if $string =~ m!\A$X?<=\s*($number)\z!; |
18
|
28
|
100
|
|
|
|
490
|
return $factory->new("$1", 'or_less') if $string =~ m!\A($number)\s*>=$X\z!; |
19
|
27
|
100
|
|
|
|
538
|
return $factory->new("$1", 'or_less') |
20
|
|
|
|
|
|
|
if $string =~ m!\A($number)\s+or\s+less\z!; |
21
|
|
|
|
|
|
|
|
22
|
26
|
|
|
|
|
124
|
return; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub valid_args { |
26
|
92
|
|
|
92
|
1
|
149
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
92
|
100
|
|
|
|
140
|
return unless 2 == grep { defined } @_; |
|
204
|
|
|
|
|
466
|
|
29
|
37
|
100
|
|
|
|
107
|
return unless $_[1] eq 'or_less'; |
30
|
|
|
|
|
|
|
|
31
|
14
|
|
|
|
|
40
|
return $self->normalize_number($_[0]); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |