From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 746C91F61A for ; Wed, 26 Feb 2020 00:44:05 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] searchview: improve naming and simplify hash override Date: Wed, 26 Feb 2020 00:44:05 +0000 Message-Id: <20200226004405.27845-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: `%over' could be confused for the overview SQLite DB instance, so call it `%override', instead. There's also no need to write a loop to override a hash when the language can do it for us. --- lib/PublicInbox/SearchView.pm | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index 0bd94774..287b0a28 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -366,14 +366,10 @@ sub new { } sub qs_html { - my ($self, %over) = @_; + my ($self, %override) = @_; - if (keys %over) { - my $tmp = bless { %$self }, ref($self); - foreach my $k (keys %over) { - $tmp->{$k} = $over{$k}; - } - $self = $tmp; + if (scalar(keys(%override))) { + $self = bless { (%$self, %override) }, ref($self); } my $q = uri_escape($self->{'q'}, MID_ESC);