From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A5F4F20578 for ; Mon, 7 Mar 2016 17:43:18 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] daemon: allow using IO::Socket::IP over INET6 Date: Mon, 7 Mar 2016 17:43:19 +0000 Message-Id: <20160307174319.29633-1-e@80x24.org> List-Id: 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