about summary refs log tree commit homepage
path: root/lib/PublicInbox/POP3.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-08-10 15:58:01 +0000
committerEric Wong <e@80x24.org>2022-08-10 20:11:10 +0000
commit69a839362deecd86771f306f20ff993f9c9c07c1 (patch)
treeafa97ae342b24844e8702d17596f1109445df3c4 /lib/PublicInbox/POP3.pm
parent1c457e08d2bb3352bdddde0a3580ff37f317cc72 (diff)
downloadpublic-inbox-69a839362deecd86771f306f20ff993f9c9c07c1.tar.gz
warn/carp usage is unavoidable given Perl itself and standard
libraries, so just rely on localized $SIG{__WARN__} from
60d262483a4d6ddf (daemon: use per-listener SIG{__WARN__} callbacks, 2022-08-08)
for all error reporting.

While we're in the area, make some of the error handling more
consistent between IMAP/NNTP/POP3.
Diffstat (limited to 'lib/PublicInbox/POP3.pm')
-rw-r--r--lib/PublicInbox/POP3.pm9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/PublicInbox/POP3.pm b/lib/PublicInbox/POP3.pm
index c993e558..82df257c 100644
--- a/lib/PublicInbox/POP3.pm
+++ b/lib/PublicInbox/POP3.pm
@@ -45,11 +45,6 @@ use constant {
 
 # XXX FIXME: duplicated stuff from NNTP.pm and IMAP.pm
 
-sub err ($$;@) {
-        my ($self, $fmt, @args) = @_;
-        printf { $self->{pop3d}->{err} } $fmt."\n", @args;
-}
-
 sub out ($$;@) {
         my ($self, $fmt, @args) = @_;
         printf { $self->{pop3d}->{out} } $fmt."\n", @args;
@@ -364,8 +359,8 @@ sub process_line ($$) {
                 \"-ERR command not recognized\r\n";
         my $err = $@;
         if ($err && $self->{sock}) {
-                chomp($l);
-                err($self, 'error from: %s (%s)', $l, $err);
+                $l =~ s/\r?\n//s;
+                warn("error from: $l ($err)\n");
                 $res = \"-ERR program fault - command not performed\r\n";
         }
         defined($res) ? $self->write($res) : 0;