| 1 | 25 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 25 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | # ABSTRACT: a tolerance "m <= n" | ||||||||||
| 4 | |||||||||||
| 5 | package | ||||||||||
| 6 | Number::Tolerant::Type::or_less; | ||||||||||
| 7 | 25 | ▶ | use parent qw(Number::Tolerant::Type); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 14 | ▶ | sub construct { shift; { value => $_[0], max => $_[0] } } | ||||||||
|
Subroutine
construct: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 10 | |||||||||||
| 11 | 24 | ▶ | sub parse { | ||||||||
|
Subroutine
parse: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 12 | 24 | my ($self, $string, $factory) = @_; | |||||||||
| 13 | |||||||||||
| 14 | 24 | my $number = $self->number_re; | |||||||||
| 15 | 24 | my $X = $self->variable_re; | |||||||||
| 16 | |||||||||||
| 17 | 24 | ▶ | return $factory->new("$1", 'or_less') if $string =~ m!\A$X?<=\s*($number)\z!; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 23 | ▶ | return $factory->new("$1", 'or_less') if $string =~ m!\A($number)\s*>=$X\z!; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 22 | ▶ | return $factory->new("$1", 'or_less') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | if $string =~ m!\A($number)\s+or\s+less\z!; | ||||||||||
| 21 | |||||||||||
| 22 | 21 | return; | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 98 | ▶ | sub valid_args { | ||||||||
|
Subroutine
valid_args: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 26 | 98 | my $self = shift; | |||||||||
| 27 | |||||||||||
| 28 | 98 | ▶ | return unless 2 == grep { defined } @_; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 35 | ▶ | return unless $_[1] eq 'or_less'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | |||||||||||
| 31 | 14 | return $self->normalize_number($_[0]); | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 25 | 1; | |||||||||
| 35 | |||||||||||
| 36 | __END__ | ||||||||||