From 854862946453e829243735e22c6cabc43b47a70c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 24 Dec 2015 01:39:45 +0000 Subject: [PATCH] repobrowse: DRY-up query class and support id2 We'll be adding diff support against arbitrary objects, soon (which could cause us to be OOM-ed easily if we're not careful with big objects). --- lib/PublicInbox/RepoBrowseQuery.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/RepoBrowseQuery.pm b/lib/PublicInbox/RepoBrowseQuery.pm index 979a2b683..861e587b6 100644 --- a/lib/PublicInbox/RepoBrowseQuery.pm +++ b/lib/PublicInbox/RepoBrowseQuery.pm @@ -1,16 +1,18 @@ # Copyright (C) 2015 all contributors # License: AGPL-3.0+ +# query parameter management for repobrowse package PublicInbox::RepoBrowseQuery; use strict; use warnings; use PublicInbox::Hval; +my @KNOWN_PARAMS = qw(id id2 h showmsg ofs); sub new { my ($class, $cgi) = @_; my $self = bless {}, $class; - foreach my $k (qw(id h showmsg ofs)) { + foreach my $k (@KNOWN_PARAMS) { my $v = $cgi->param($k); $self->{$k} = defined $v ? $v : ''; } @@ -27,7 +29,7 @@ sub qs { } my @qs; - foreach my $k (qw(id h showmsg ofs)) { + foreach my $k (@KNOWN_PARAMS) { my $v = $self->{$k}; next if ($v eq ''); -- 2.47.3