* [PATCH 0/3] watch-related IMAP/NNTP tweaks
@ 2023-03-13 19:38 Eric Wong
2023-03-13 19:38 ` [PATCH 1/3] use v5.12 for various network client-side packages Eric Wong
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Wong @ 2023-03-13 19:38 UTC (permalink / raw)
To: meta
Forcing myself to use the slow IMAP/NNTP client libraries and
maybe make them pipelined someday...
Eric Wong (3):
use v5.12 for various network client-side packages
spamcheck: use v5.12 and golf
watch: add space before "UID" or "ARTICLE" in warnings
lib/PublicInbox/GitCredential.pm | 8 +++++---
lib/PublicInbox/NetNNTPSocks.pm | 5 ++---
lib/PublicInbox/NetReader.pm | 3 +--
lib/PublicInbox/NetWriter.pm | 5 ++---
lib/PublicInbox/Spamcheck.pm | 12 ++++--------
lib/PublicInbox/Spamcheck/Spamc.pm | 5 ++---
lib/PublicInbox/URIimap.pm | 5 ++---
lib/PublicInbox/URInntps.pm | 4 ++--
lib/PublicInbox/Watch.pm | 4 ++--
9 files changed, 22 insertions(+), 29 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] use v5.12 for various network client-side packages
2023-03-13 19:38 [PATCH 0/3] watch-related IMAP/NNTP tweaks Eric Wong
@ 2023-03-13 19:38 ` Eric Wong
2023-03-13 19:38 ` [PATCH 2/3] spamcheck: use v5.12 and golf Eric Wong
2023-03-13 19:38 ` [PATCH 3/3] watch: add space before "UID" or "ARTICLE" in warnings Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2023-03-13 19:38 UTC (permalink / raw)
To: meta
None of these are affected by the Perl unicode_strings feature,
so they can `use v5.12' safely
---
lib/PublicInbox/GitCredential.pm | 8 +++++---
lib/PublicInbox/NetNNTPSocks.pm | 5 ++---
lib/PublicInbox/NetReader.pm | 3 +--
lib/PublicInbox/NetWriter.pm | 5 ++---
lib/PublicInbox/URIimap.pm | 5 ++---
lib/PublicInbox/URInntps.pm | 4 ++--
6 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/lib/PublicInbox/GitCredential.pm b/lib/PublicInbox/GitCredential.pm
index b18bba1e..10114a10 100644
--- a/lib/PublicInbox/GitCredential.pm
+++ b/lib/PublicInbox/GitCredential.pm
@@ -1,7 +1,9 @@
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+
+# git-credential wrapper with built-in .netrc fallback
package PublicInbox::GitCredential;
-use strict;
+use v5.12;
use PublicInbox::Spawn qw(popen_rd);
sub run ($$;$) {
@@ -19,7 +21,7 @@ sub run ($$;$) {
my $out = '';
for my $k (qw(url protocol host username password)) {
- defined(my $v = $self->{$k}) or next;
+ my $v = $self->{$k} // next;
die "`$k' contains `\\n' or `\\0'\n" if $v =~ /[\n\0]/;
$out .= "$k=$v\n";
}
diff --git a/lib/PublicInbox/NetNNTPSocks.pm b/lib/PublicInbox/NetNNTPSocks.pm
index 8495204a..fcd2e580 100644
--- a/lib/PublicInbox/NetNNTPSocks.pm
+++ b/lib/PublicInbox/NetNNTPSocks.pm
@@ -1,10 +1,9 @@
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# wrap Net::NNTP client with SOCKS support
package PublicInbox::NetNNTPSocks;
-use strict;
-use v5.10.1;
+use v5.12;
use Net::NNTP;
our %OPT;
our @ISA = qw(IO::Socket::Socks);
diff --git a/lib/PublicInbox/NetReader.pm b/lib/PublicInbox/NetReader.pm
index 4de2583e..6802fa72 100644
--- a/lib/PublicInbox/NetReader.pm
+++ b/lib/PublicInbox/NetReader.pm
@@ -3,8 +3,7 @@
# common reader code for IMAP and NNTP (and maybe JMAP)
package PublicInbox::NetReader;
-use strict;
-use v5.10.1;
+use v5.12;
use parent qw(Exporter PublicInbox::IPC);
use PublicInbox::Eml;
use PublicInbox::Config;
diff --git a/lib/PublicInbox/NetWriter.pm b/lib/PublicInbox/NetWriter.pm
index 4a1f34f6..7917ef89 100644
--- a/lib/PublicInbox/NetWriter.pm
+++ b/lib/PublicInbox/NetWriter.pm
@@ -1,10 +1,9 @@
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# common writer code for IMAP (and later, JMAP)
package PublicInbox::NetWriter;
-use strict;
-use v5.10.1;
+use v5.12;
use parent qw(PublicInbox::NetReader);
use PublicInbox::Smsg;
use PublicInbox::MsgTime qw(msg_timestamp);
diff --git a/lib/PublicInbox/URIimap.pm b/lib/PublicInbox/URIimap.pm
index 81644914..41c2842a 100644
--- a/lib/PublicInbox/URIimap.pm
+++ b/lib/PublicInbox/URIimap.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# cf. RFC 5092, which the `URI' package doesn't support
#
@@ -11,8 +11,7 @@
#
# RFC 2192 also describes ";TYPE=<list_type>"
package PublicInbox::URIimap;
-use strict;
-use v5.10.1;
+use v5.12;
use URI::Split qw(uri_split uri_join); # part of URI
use URI::Escape qw(uri_unescape uri_escape);
use overload '""' => \&as_string;
diff --git a/lib/PublicInbox/URInntps.pm b/lib/PublicInbox/URInntps.pm
index 231b247b..88c8d641 100644
--- a/lib/PublicInbox/URInntps.pm
+++ b/lib/PublicInbox/URInntps.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# deal with the lack of URI::nntps in upstream URI.
@@ -6,7 +6,7 @@
# cf. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983419
# Fixed in URI 5.08, we can drop this by 2035 when LTS distros all have it
package PublicInbox::URInntps;
-use strict;
+use v5.12;
use parent qw(URI::snews);
use URI;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] spamcheck: use v5.12 and golf
2023-03-13 19:38 [PATCH 0/3] watch-related IMAP/NNTP tweaks Eric Wong
2023-03-13 19:38 ` [PATCH 1/3] use v5.12 for various network client-side packages Eric Wong
@ 2023-03-13 19:38 ` Eric Wong
2023-03-13 19:38 ` [PATCH 3/3] watch: add space before "UID" or "ARTICLE" in warnings Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2023-03-13 19:38 UTC (permalink / raw)
To: meta
No problems with `unicode_strings' in these modules. We can
also shave our LoC count in a few places.
---
lib/PublicInbox/Spamcheck.pm | 12 ++++--------
lib/PublicInbox/Spamcheck/Spamc.pm | 5 ++---
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/lib/PublicInbox/Spamcheck.pm b/lib/PublicInbox/Spamcheck.pm
index d8fa80c8..fbf9355d 100644
--- a/lib/PublicInbox/Spamcheck.pm
+++ b/lib/PublicInbox/Spamcheck.pm
@@ -1,21 +1,17 @@
-# Copyright (C) 2018-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Spamchecking used by -watch and -mda tools
package PublicInbox::Spamcheck;
-use strict;
-use warnings;
+use v5.12;
sub get {
my ($cfg, $key, $default) = @_;
- my $spamcheck = $cfg->{$key};
- $spamcheck = $default unless $spamcheck;
+ my $spamcheck = $cfg->{$key} || $default;
return if !$spamcheck || $spamcheck eq 'none';
- if ($spamcheck eq 'spamc') {
- $spamcheck = 'PublicInbox::Spamcheck::Spamc';
- }
+ $spamcheck = 'PublicInbox::Spamcheck::Spamc' if $spamcheck eq 'spamc';
if ($spamcheck =~ /::/) {
eval "require $spamcheck";
return $spamcheck->new;
diff --git a/lib/PublicInbox/Spamcheck/Spamc.pm b/lib/PublicInbox/Spamcheck/Spamc.pm
index d2b6429c..2f821532 100644
--- a/lib/PublicInbox/Spamcheck/Spamc.pm
+++ b/lib/PublicInbox/Spamcheck/Spamc.pm
@@ -1,10 +1,9 @@
-# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Default spam filter class for wrapping spamc(1)
package PublicInbox::Spamcheck::Spamc;
-use strict;
-use warnings;
+use v5.12;
use PublicInbox::Spawn qw(popen_rd spawn);
use IO::Handle;
use Fcntl qw(SEEK_SET);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] watch: add space before "UID" or "ARTICLE" in warnings
2023-03-13 19:38 [PATCH 0/3] watch-related IMAP/NNTP tweaks Eric Wong
2023-03-13 19:38 ` [PATCH 1/3] use v5.12 for various network client-side packages Eric Wong
2023-03-13 19:38 ` [PATCH 2/3] spamcheck: use v5.12 and golf Eric Wong
@ 2023-03-13 19:38 ` Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2023-03-13 19:38 UTC (permalink / raw)
To: meta
In other words, it now shows `imap://example.com/INBOX.foo UID:123'
instead of: `imap://example.com/INBOX.foo UID:123'
---
lib/PublicInbox/Watch.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm
index 90d82d21..d9aadf82 100644
--- a/lib/PublicInbox/Watch.pm
+++ b/lib/PublicInbox/Watch.pm
@@ -312,7 +312,7 @@ sub imap_fetch_all ($$) {
local $SIG{__WARN__} = sub {
my $pfx = ($_[0] // '') =~ /^([A-Z]: |# )/g ? $1 : '';
my $uid = $self->{cur_uid};
- $warn_cb->("$pfx$uri", $uid ? ("UID:$uid") : (), "\n", @_);
+ $warn_cb->("$pfx$uri", $uid ? (" UID:$uid") : (), "\n", @_);
};
PublicInbox::NetReader::imap_each($self, $uri, \&net_cb, $self,
$self->{imap}->{$$uri});
@@ -451,7 +451,7 @@ sub watch_nntp_fetch_all ($$) {
local $SIG{__WARN__} = sub {
my $pfx = ($_[0] // '') =~ /^([A-Z]: |# )/g ? $1 : '';
my $art = $self->{cur_uid};
- $warn_cb->("$pfx$uri", $art ? ("ARTICLE $art") : (), "\n", @_);
+ $warn_cb->("$pfx$uri", $art ? (" ARTICLE $art") : (), "\n", @_);
};
for $uri (@$uris) {
PublicInbox::NetReader::nntp_each($self, $uri, \&net_cb, $self,
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-13 19:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13 19:38 [PATCH 0/3] watch-related IMAP/NNTP tweaks Eric Wong
2023-03-13 19:38 ` [PATCH 1/3] use v5.12 for various network client-side packages Eric Wong
2023-03-13 19:38 ` [PATCH 2/3] spamcheck: use v5.12 and golf Eric Wong
2023-03-13 19:38 ` [PATCH 3/3] watch: add space before "UID" or "ARTICLE" in warnings Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).