File perl-Socket-GetAddrInfo.spec of Package perl-Socket-GetAddrInfo

# spec file for package perl-Socket-GetAddrInfo
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           perl-Socket-GetAddrInfo
Version:        0.22
Release:        0
%define cpan_name Socket-GetAddrInfo
Summary:        Address-Family Independent Name Resolving Functions
License:        Artistic-1.0 or GPL-1.0+
Group:          Development/Libraries/Perl
Source1:        cpanspec.yml
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  perl
BuildRequires:  perl-macros
BuildRequires:  perl(ExtUtils::CBuilder)
BuildRequires:  perl(ExtUtils::CChecker) >= 0.06
BuildRequires:  perl(Module::Build)
BuildRequires:  perl(Module::Build::Compat)
BuildRequires:  perl(Socket) >= 2.013
Requires:       perl(Socket) >= 2.013

The RFC 2553 functions 'getaddrinfo' and 'getnameinfo' provide an
abstracted way to convert between a pair of host name/service name and
socket addresses, or vice versa. 'getaddrinfo' converts names into a set of
arguments to pass to the 'socket()' and 'connect()' syscalls, and
'getnameinfo' converts a socket address back into its host name/service
name pair.

These functions provide a useful interface for performing either of these
name resolution operation, without having to deal with IPv4/IPv6
transparency, or whether the underlying host can support IPv6 at all, or
other such issues. However, not all platforms can support the underlying
calls at the C layer, which means a dilema for authors wishing to write
forward-compatible code. Either to support these functions, and cause the
code not to work on older platforms, or stick to the older "legacy"
resolvers such as 'gethostbyname()', which means the code becomes more

This module attempts to solve this problem, by detecting at compiletime
whether the underlying OS will support these functions. If it does not, the
module will use pure-perl emulations of the functions using the legacy
resolver functions instead. The emulations support the same interface as
the real functions, and behave as close as is resonably possible to emulate
using the legacy resolvers. See the Socket::GetAddrInfo::Emul manpage for
details on the limits of this emulation.

As of Perl version 5.14.0, Perl already supports 'getaddrinfo' in core. On
such a system, this module simply uses the functions provided by 'Socket',
and does not need to use its own compiled XS, or pure-perl legacy

As 'Socket' in core now provides all the functions also provided by this
module, it is likely this may be the last released version of this module.
And code currently using this module would be advised to switch to using
core 'Socket' instead.

%setup -q -n %{cpan_name}-%{version}

%{__perl} Build.PL installdirs=vendor optimize="%{optflags}"
./Build build flags=%{?_smp_mflags}

./Build test

./Build install destdir=%{buildroot} create_packlist=0

%files -f %{name}.files

openSUSE Build Service is sponsored by