about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-01-31 22:28:31 -1000
committerEric Wong <e@80x24.org>2021-02-01 11:38:26 +0000
commit1d34aa20424c96fa99de27bc02c160e1de56c0a6 (patch)
treebd50d921ad778837d98d62ca24fe6ffc03ddf4eb
parent0795b0906cc81f400e0e5b9b53f812627dbd19c0 (diff)
downloadpublic-inbox-1d34aa20424c96fa99de27bc02c160e1de56c0a6.tar.gz
$_ at the top of a potentially deep stack below may cause
surprising behavior as I experienced with ExtSearchIdx.  In the
future, we'll limit our $_ usage to easily-auditable bits (e.g.
map, grep, and small for loops)
-rw-r--r--lib/PublicInbox/DS.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index 2d312f0a..263c3458 100644
--- a/lib/PublicInbox/DS.pm
+++ b/lib/PublicInbox/DS.pm
@@ -162,13 +162,13 @@ sub now () { clock_gettime(CLOCK_MONOTONIC) }
 sub next_tick () {
     my $q = $nextq or return;
     $nextq = undef;
-    for (@$q) {
+    for my $obj (@$q) {
         # we avoid "ref" on blessed refs to workaround a Perl 5.16.3 leak:
         # https://rt.perl.org/Public/Bug/Display.html?id=114340
-        if (blessed($_)) {
-            $_->event_step;
+        if (blessed($obj)) {
+            $obj->event_step;
         } else {
-            $_->();
+            $obj->();
         }
     }
 }