]> Sergey Matveev's repositories - public-inbox.git/commitdiff
searchview: improve naming and simplify hash override
authorEric Wong <e@yhbt.net>
Wed, 26 Feb 2020 00:44:05 +0000 (00:44 +0000)
committerEric Wong <e@yhbt.net>
Thu, 27 Feb 2020 08:48:52 +0000 (08:48 +0000)
`%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

index 0bd94774942da048f726fbd4e9a4f38fff665e13..287b0a280575885f9c51678e80ed8b7ea277bc6d 100644 (file)
@@ -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);