about summary refs log tree commit homepage
path: root/lib/PublicInbox/Watch.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-26 01:44:36 +0000
committerEric Wong <e@80x24.org>2020-12-26 19:27:15 +0000
commit0b018bebe7d8ee807ab07b570cf33669da4875b0 (patch)
tree9a0eb73298a8226b722d81db1d88a2fdb7d7adcf /lib/PublicInbox/Watch.pm
parentb5e960f50289434025f5904c8c1311e4c8a02b82 (diff)
downloadpublic-inbox-0b018bebe7d8ee807ab07b570cf33669da4875b0.tar.gz
As with CORE::die and $SIG{__DIE__}, it turns out CORE::warn is
safe to use inside $SIG{__WARN__} handlers without triggering
infinite recursion.  So fall back to reusing CORE::warn instead
of creating a new sub.
Diffstat (limited to 'lib/PublicInbox/Watch.pm')
-rw-r--r--lib/PublicInbox/Watch.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index e1246096..bc296e01 100644
--- a/lib/PublicInbox/Watch.pm
+++ b/lib/PublicInbox/Watch.pm
@@ -217,7 +217,7 @@ sub _try_path {
                 warn "unmappable dir: $1\n";
                 return;
         }
-        my $warn_cb = $SIG{__WARN__} || sub { print STDERR @_ };
+        my $warn_cb = $SIG{__WARN__} || \&CORE::warn;
         local $SIG{__WARN__} = sub {
                 my $pfx = ($_[0] // '') =~ /^([A-Z]: )/g ? $1 : '';
                 $warn_cb->($pfx, "path: $path\n", @_);
@@ -467,7 +467,7 @@ sub imap_fetch_all ($$$) {
         my $key = $req;
         $key =~ s/\.PEEK//;
         my ($uids, $batch);
-        my $warn_cb = $SIG{__WARN__} || sub { print STDERR @_ };
+        my $warn_cb = $SIG{__WARN__} || \&CORE::warn;
         local $SIG{__WARN__} = sub {
                 my $pfx = ($_[0] // '') =~ /^([A-Z]: )/g ? $1 : '';
                 $batch //= '?';
@@ -929,7 +929,7 @@ sub nntp_fetch_all ($$$) {
         $beg = $l_art + 1;
 
         warn "I: $url fetching ARTICLE $beg..$end\n";
-        my $warn_cb = $SIG{__WARN__} || sub { print STDERR @_ };
+        my $warn_cb = $SIG{__WARN__} || \&CORE::warn;
         my ($err, $art);
         local $SIG{__WARN__} = sub {
                 my $pfx = ($_[0] // '') =~ /^([A-Z]: )/g ? $1 : '';