Get the AF_INET and friends constants from Socket

Apparently it is enough to simply import Socket or IO::Socket to use
AF_INET and friends, but all examples in official documentation show
them in the import list. Because I do not fully understand the
intricacies of Perl import logic, I do the same thing here, fully
aware that I might have joined a cargo cult. Regardless of its
correctness or necessity, listing the constants in the import list has
the advantage of making it clear why the `use` statement exists.

I chose to import the constants from Socket instead of IO::Socket
because that module's documentation explicitly documents the
constants.
This commit is contained in:
Richard Hansen 2020-07-07 20:42:40 -04:00
parent 3b931fb0a6
commit 6ff0362450
2 changed files with 2 additions and 2 deletions

View file

@ -40,7 +40,7 @@ m4_foreach_w([_m], [
File::Basename
File::Path
Getopt::Long
IO::Socket
Socket
Sys::Hostname
version=0.77
], [AX_PROG_PERL_MODULES([_m], [],

View file

@ -25,8 +25,8 @@ use warnings;
use File::Basename;
use File::Path qw(make_path);
use Getopt::Long;
use Socket qw(AF_INET AF_INET6 PF_INET PF_INET6);
use Sys::Hostname;
use IO::Socket;
use version 0.77; our $VERSION = version->declare('v3.9.1');
(my $version = $VERSION->stringify()) =~ s/^v//;