11 PF_INET SOCK_STREAM IPPROTO_TCP pack_sockaddr_in INADDR_ANY
12 AI_PASSIVE AI_NUMERICSERV
15 my $AI_ADDRCONFIG = eval { Socket::AI_ADDRCONFIG() } || 0;
21 no warnings 'redefine';
23 *{"IO::Socket::IP::getaddrinfo"} = sub {
24 push @gai_args, [ @_ ];
25 return @{ shift @gai_rets };
32 socktype => SOCK_STREAM,
33 protocol => IPPROTO_TCP,
34 addr => pack_sockaddr_in( 80, INADDR_ANY )
37 IO::Socket::IP->new( LocalPort => "80" );
39 is_deeply( \@gai_args,
41 [ undef, "80", { flags => AI_PASSIVE|$AI_ADDRCONFIG, socktype => SOCK_STREAM, protocol => IPPROTO_TCP } ],
43 '@gai_args for LocalPort => "80"' );
46 skip "No AI_NUMERICSERV", 1 unless defined eval { AI_NUMERICSERV() };
52 socktype => SOCK_STREAM,
53 protocol => IPPROTO_TCP,
54 addr => pack_sockaddr_in( 80, INADDR_ANY )
57 IO::Socket::IP->new( LocalPort => "80", GetAddrInfoFlags => AI_NUMERICSERV );
59 is_deeply( \@gai_args,
61 [ undef, "80", { flags => AI_PASSIVE|AI_NUMERICSERV, socktype => SOCK_STREAM, protocol => IPPROTO_TCP } ],
63 '@gai_args for LocalPort => "80", GetAddrInfoFlags => AI_NUMERICSERV' );