From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH] searchview: improve naming and simplify hash override
Date: Wed, 26 Feb 2020 00:44:05 +0000 [thread overview]
Message-ID: <20200226004405.27845-1-e@yhbt.net> (raw)
`%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);
reply other threads:[~2020-02-26 0:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200226004405.27845-1-e@yhbt.net \
--to=e@yhbt.net \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).