http://www.perlmonks.org?node_id=897977

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have problem with the tests in HTTP-Server-Simple-0.44.

I am using:

This is setup_listener from HTTP-Server-Simple-0.44/lib/HTTP/Server/Simple.pm

sub setup_listener { my $self = shift; my $tcp = getprotobyname('tcp'); socket( HTTPDaemon, PF_INET, SOCK_STREAM, $tcp ) or croak "socket: + $!"; setsockopt( HTTPDaemon, SOL_SOCKET, SO_REUSEADDR, pack( "l", 1 ) ) or warn "setsockopt: $!"; bind( HTTPDaemon, sockaddr_in( $self->port(), ( $self->host ? inet_aton( $self->host ) : INADDR_ANY ) ) ) or croak "bind to @{[$self->host||'*']}:@{[$self->port]}: $!"; listen( HTTPDaemon, SOMAXCONN ) or croak "listen: $!"; }

When running some of tests, $self->host is undefined and the call to listen does not return (and sometimes get Windows 7 in blocked state). ($self->host with the value '0.0.0.0' used by Plack does also not work.)

Adding this before bind is a workaround

$self->host('localhost') if ! defined $self->host; $self->host('localhost') if $self->host eq '0.0.0.0';

Is this a bug in Windows or what is a proper solution?