user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] daemon: allow using IO::Socket::IP over INET6
@ 2016-03-07 17:43 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-03-07 17:43 UTC (permalink / raw)
  To: meta

IO::Socket::IP is bundled with newer versions of Perl,
so it is more likely to be available.  There should
be no differences between these with our use cases.
---
 lib/PublicInbox/Daemon.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index a6707e8..fcb1a3d 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -68,8 +68,11 @@ sub daemon_prepare ($) {
 			}
 			$o{Local} = delete $o{Peer};
 		} else {
-			$sock_pkg = 'IO::Socket::INET6'; # works for IPv4, too
-			eval "use $sock_pkg";
+			# both work for IPv4, too
+			for $sock_pkg (qw(IO::Socket::IP IO::Socket::INET6)) {
+				eval "use $sock_pkg";
+				$@ or last;
+			}
 			die $@ if $@;
 			%o = (LocalAddr => $l, ReuseAddr => 1, Proto => 'tcp');
 		}
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-07 17:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-07 17:43 [PATCH] daemon: allow using IO::Socket::IP over INET6 Eric Wong

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).