AnyEvent::Socket::inet_aton bug & patch
Maxime Soulé
btik-cpan at scoubidou.com
Tue Sep 11 18:14:45 CEST 2012
Hello,
It seems that AnyEvent::Socket::inet_aton function does not work as
expected.
Trying with www.google.com will give you some undefined and/or wrong
entries.
When a DNS resolution is needed, parse_ipv4 and parse_ipv6 are
repeatedly called in map using the &xxx syntax instead of passing $_ as
parameter.
Moreover, $ipn variable does not need to be declared again, in the first
"elsif".
The attached patch correct these problems.
Best regards,
Max.
-------------- next part --------------
--- AnyEvent-7.02/lib/AnyEvent/Socket.pm.orig 2012-06-25 13:03:52.000000000 +0200
+++ AnyEvent-7.02/lib/AnyEvent/Socket.pm 2012-09-11 18:01:37.000000000 +0200
@@ -472,7 +472,7 @@
if (my $ipn = &parse_ipv4) {
$cb->($ipn);
- } elsif (my $ipn = &parse_ipv6) {
+ } elsif ($ipn = &parse_ipv6) {
$cb->($ipn);
} elsif ($name eq "localhost") { # rfc2606 et al.
$cb->(v127.0.0.1, v0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1);
@@ -493,7 +493,7 @@
if ($ipv4) {
$cv->begin;
AnyEvent::DNS::a ($name, sub {
- $res[$ipv4] = [map &parse_ipv4, @_];
+ $res[$ipv4] = [map { parse_ipv4 $_ } @_];
$cv->end;
});
};
@@ -501,7 +501,7 @@
if ($ipv6) {
$cv->begin;
AnyEvent::DNS::aaaa ($name, sub {
- $res[$ipv6] = [map &parse_ipv6, @_];
+ $res[$ipv6] = [map { parse_ipv6 $_ } @_];
$cv->end;
});
};
More information about the anyevent
mailing list