From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/2] tests: favor IO::Socket::IP for IPv6 listeners
Date: Tue, 12 Sep 2023 12:25:23 +0000 [thread overview]
Message-ID: <20230912122525.1776117-2-e@80x24.org> (raw)
In-Reply-To: <20230912122525.1776117-1-e@80x24.org>
IO::Socket::IP is bundled with Perl 5.24+ so it's more likely
to be available than IO::Socket::INET6.
---
lib/PublicInbox/TestCommon.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index 17057e18..b1a37ced 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -62,8 +62,12 @@ sub tcp_server () {
);
eval {
die 'IPv4-only' if $ENV{TEST_IPV4_ONLY};
- require IO::Socket::INET6;
- IO::Socket::INET6->new(%opt, LocalAddr => '[::1]')
+ my $pkg;
+ for (qw(IO::Socket::IP IO::Socket::INET6)) {
+ eval "require $_" or next;
+ $pkg = $_ and last;
+ }
+ $pkg->new(%opt, LocalAddr => '[::1]');
} || eval {
die 'IPv6-only' if $ENV{TEST_IPV6_ONLY};
IO::Socket::INET->new(%opt, LocalAddr => '127.0.0.1')
next prev parent reply other threads:[~2023-09-12 12:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-12 12:25 [PATCH 0/2] test fixes for optional deps Eric Wong
2023-09-12 12:25 ` Eric Wong [this message]
2023-09-12 12:25 ` [PATCH 2/2] tests: allow more tests to pass without xapian-compact Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230912122525.1776117-2-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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).