about summary refs log tree commit homepage
path: root/lib/PublicInbox/SharedKV.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-11-01 19:06:09 +0000
committerEric Wong <e@80x24.org>2021-11-01 19:49:39 +0000
commit8d2513221e73649aed85ce8c3f37f7025ec1fec9 (patch)
treef133a22e4174ae5326a45ca2a3dc63604f0c72d4 /lib/PublicInbox/SharedKV.pm
parentb46de4da83d797281af9603f350e5b7105845eed (diff)
downloadpublic-inbox-8d2513221e73649aed85ce8c3f37f7025ec1fec9.tar.gz
treewide: kill problematic "$h->{k} //= do {" assignments
As stated in the previous change, conditional hash assignments
which trigger other hash assignments seem problematic, at times.
So replace:

	$h->{k} //= do { $h->{x} = ...; $val };

	$h->{k} // do {
		$h->{x} = ...;
		$hk->{k} = $val
	};

"||=" is affected the same way, and some instances of "||=" are
replaced with "//=" or "// do {", now.
Diffstat (limited to 'lib/PublicInbox/SharedKV.pm')
-rw-r--r--lib/PublicInbox/SharedKV.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/SharedKV.pm b/lib/PublicInbox/SharedKV.pm
index 27407f83..4297efed 100644
--- a/lib/PublicInbox/SharedKV.pm
+++ b/lib/PublicInbox/SharedKV.pm
@@ -15,7 +15,7 @@ use File::Path qw(rmtree make_path);
 
 sub dbh {
         my ($self, $lock) = @_;
-        $self->{dbh} //= do {
+        $self->{dbh} // do {
                 my $f = $self->{filename};
                 $lock //= $self->lock_for_scope_fast;
                 my $dbh = DBI->connect("dbi:SQLite:dbname=$f", '', '', {
@@ -36,7 +36,7 @@ CREATE TABLE IF NOT EXISTS kv (
         UNIQUE (k)
 )
 
-                $dbh;
+                $self->{dbh} = $dbh;
         }
 }