From 3f3d9cf7d88a851721f1f8468e1311a4f0c02ff6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 1 Apr 2018 22:58:19 +0000 Subject: searchview: fix non-numeric comparison We don't want non-fully-numeric limits being compared and tripping warnings. While we're at it, avoid hard-coding '200' and reuse $LIM as the default. --- lib/PublicInbox/SearchView.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index bf4415f0..219006a0 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -309,10 +309,8 @@ sub new { my ($class, $qp) = @_; my $r = $qp->{r}; - my $l = $qp->{l} || '200'; - if (! ($l =~ /(\d+)/ && $l <= $LIM)) { - $l = $LIM; - } + my ($l) = (($qp->{l} || '') =~ /(\d+)/); + $l = $LIM if !$l || $l > $LIM; bless { q => $qp->{'q'}, x => $qp->{x} || '', -- cgit v1.2.3-24-ge0c7