Skip to content

Commit

Permalink
Remove use of Socket::GetAddrInfo.
Browse files Browse the repository at this point in the history
Socket 2.001 (and possibly earlier) expose getaddrinfo() so we don't
need Socket::GetAddrInfo anymore.  Also, the author of that module
suggests that it's obsolete since Socket provides it now.
  • Loading branch information
rcaputo committed Jun 3, 2012
1 parent 4a415e5 commit 2a03812
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion dist.ini
Expand Up @@ -6,7 +6,7 @@ copyright_holder = Rocco Caputo
[Prereqs]
POE = 1.311
Scalar::Util = 1.23
Socket::GetAddrInfo = 0.22
Socket = 2.001
Storable = 2.18
Test::More = 0.96
Time::HiRes = 1.9711
Expand Down
34 changes: 17 additions & 17 deletions lib/POE/Component/Resolver.pm
Expand Up @@ -6,8 +6,10 @@ use strict;
use POE qw(Wheel::Run Filter::Reference);
use Carp qw(croak carp);
use Time::HiRes qw(time);
use Socket qw(unpack_sockaddr_in AF_INET AF_INET6);
use Socket::GetAddrInfo qw(getnameinfo NI_NUMERICHOST NI_NUMERICSERV);
use Socket qw(
unpack_sockaddr_in AF_INET AF_INET6
getnameinfo NI_NUMERICSERV NI_NUMERICHOST
);

use POE::Component::Resolver::Sidecar;

Expand Down Expand Up @@ -574,13 +576,14 @@ POE::Component::Resolver - A non-blocking getaddrinfo() resolver
=head1 DESCRIPTION
POE::Component::Resolver performs Socket::GetAddrInfo::getaddrinfo()
calls in subprocesses where they're permitted to block as long as
necessary.
POE::Component::Resolver performs Socket::getaddrinfo() calls in
subprocesses where they're permitted to block as long as necessary.
By default it will run eight subprocesses and prefer address families
in whatever order Socket::GetAddrInfo returns them. These defaults
can be overridden with constructor parameters.
in whatever order getaddrinfo() returns them. These defaults can be
overridden with constructor parameters. getaddrinfo() delegates to
the operating system's resolver, which may be reconfigured according
to the usual conventions.
=head2 PUBLIC METHODS
Expand Down Expand Up @@ -642,16 +645,14 @@ additional optional ones.
"host" and "service" are required and contain the host (name or
Internet address) and service (name or numeric port) that will be
passed verbatim to getaddrinfo(). See L<Socket::GetAddrInfo> for
details.
passed verbatim to getaddrinfo(). See L<Socket> for details.
"event" is optional; it contains the name of the event that will
contain the resolver response. If omitted, it will default to
"resolver_response"; you may want to specify a shorter event name.
"hints" is optional. If specified, it must contain a hashref of hints
exactly as getaddrinfo() expects them. See L<Socket::GetAddrInfo> for
details.
exactly as getaddrinfo() expects them. See L<Socket> for details.
"misc" is optional continuation data that will be passed back in the
response. It may contain any type of data the application requires.
Expand Down Expand Up @@ -700,8 +701,8 @@ In list context, it returns the numeric port and address.
}
unpack_addr() is a convenience wrapper around getnameinfo() from
Socket::GetAddrInfo. You're certainly welcome to use the discrete
function instead.
L<Socket>. You're certainly welcome to use the discrete function
instead.
unpack_addr() returns bleak emptiness on failure, regardless of
context. You can check for undef return.
Expand All @@ -712,10 +713,9 @@ context. You can check for undef return.
The resolver response event includes three parameters.
$_[ARG0] and $_[ARG1] contain the retrn values from
Socket::GetAddrInfo's getaddrinfo() call. These are an error message
(if the call failed), and an arrayref of address structures if the
call succeeded.
$_[ARG0] and $_[ARG1] contain the retrn values from Socket's
getaddrinfo() call. These are an error message (if the call failed),
and an arrayref of address structures if the call succeeded.
The component provides its own error message, 'component shut down'.
This response is given for every pending request at the time the user
Expand Down
2 changes: 1 addition & 1 deletion lib/POE/Component/Resolver/Sidecar.pm
Expand Up @@ -5,7 +5,7 @@ use strict;

use Storable qw(nfreeze thaw);

use Socket::GetAddrInfo qw(getaddrinfo);
use Socket qw(getaddrinfo);

sub main {
my $buffer = "";
Expand Down
2 changes: 1 addition & 1 deletion t/01-basic.t
Expand Up @@ -17,7 +17,7 @@ my $r4 = POE::Component::Resolver->new(

# Try to detect whether we can resolve IPv6 addresses at all.

use Socket::GetAddrInfo qw(getaddrinfo);
use Socket qw(getaddrinfo);
my $has_ipv6 = do {
my ($error, @addresses) = getaddrinfo(
"ipv6.test-ipv6.com", "www", { family => AF_INET6 }
Expand Down

0 comments on commit 2a03812

Please sign in to comment.