about summary refs log tree commit homepage
path: root/lib/PublicInbox/LEI.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/LEI.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/LEI.pm')
-rw-r--r--lib/PublicInbox/LEI.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 78b49a3b..3e1706a0 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -130,9 +130,10 @@ sub url_folder_cache {
 
 sub ale {
         my ($self) = @_;
-        $self->{ale} //= do {
+        $self->{ale} // do {
                 require PublicInbox::LeiALE;
-                $self->_lei_cfg(1)->{ale} //= PublicInbox::LeiALE->new($self);
+                my $cfg = $self->_lei_cfg(1);
+                $self->{ale} = $cfg->{ale} //= PublicInbox::LeiALE->new($self);
         };
 }
 
@@ -1159,10 +1160,10 @@ sub event_step {
 sub event_step_init {
         my ($self) = @_;
         my $sock = $self->{sock} or return;
-        $self->{-event_init_done} //= do { # persist til $ops done
+        $self->{-event_init_done} // do { # persist til $ops done
                 $sock->blocking(0);
                 $self->SUPER::new($sock, EPOLLIN);
-                $sock;
+                $self->{-event_init_done} = $sock;
         };
 }