diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-06 17:14:28 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-06 17:17:35 +1300 |
commit | c3b5c8ab9999f12b55ddae1c04a590a4123e1a31 (patch) | |
tree | 938880345602d4ee35ab072b2a172accd338d948 /lib/List/Breakdown.pm | |
parent | Correct t/intervals.t test name (diff) | |
download | List-Breakdown-c3b5c8ab9999f12b55ddae1c04a590a4123e1a31.tar.gz List-Breakdown-c3b5c8ab9999f12b55ddae1c04a590a4123e1a31.zip |
Use direct defined test not -Inf/Inf
This caused failing tests on Perl v5.8, as reported by CPANTS
Diffstat (limited to 'lib/List/Breakdown.pm')
-rw-r--r-- | lib/List/Breakdown.pm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/List/Breakdown.pm b/lib/List/Breakdown.pm index 42c610e..8aac1c9 100644 --- a/lib/List/Breakdown.pm +++ b/lib/List/Breakdown.pm @@ -35,9 +35,12 @@ my %types = ( my $bounds = shift; @{$bounds} == 2 or croak 'ARRAY ref for bounds needs two items'; - my $l = defined $bounds->[0] ? $bounds->[0] : '-Inf'; - my $u = defined $bounds->[1] ? $bounds->[1] : 'Inf'; - return [ grep { $_ >= $l and $_ < $u } @_ ]; + return [ + grep { + ( not defined $bounds->[0] or $_ >= $bounds->[0] ) + and ( not defined $bounds->[1] or $_ < $bounds->[1] ) + } @_, + ]; }, # If it's a subroutine, return a arrayref of all elements for which it |