Date: | Mon, 07 Feb 2005 21:10:58 +0100 |
From: | Max Maischein <corion [...] corion.net> |
To: | bug-HTTP-Server-Simple [...] rt.cpan.org |
Subject: | v0.02 fails tests on Win32 due to negative PID and unimplemented setsid() |
Hi Jesse,
HTTP::Server::Simple fails its test due to two reasons:
1) The POSIX::setsid() function is not implemented on Win32 and dies.
Modifying the C<background> subroutine as follows makes that work:
sub background {
my $self=shift;
my $child =fork ;
die "Can't fork: $!" unless defined($child);
return $child if $child;
use POSIX;
if ($^O !~ /MSWin32/) {
POSIX::setsid()
or die "Can't start a new session: $!";
};
$self->run();
}
2) PIDs on Win32 Perl can be negative, which t/01_live.t doesn't account
for. The following test does that:
<like($pid, qr/^\d+$/,'pid is numeric');
Show quoted text
>like($pid, qr/^-?\d+$/,'pid is numeric');
Thanks for writing this module! I have Test::HTTP::LocalServer, which
does something similar, but fires up a different kind of httpd - maybe
the two modules should be merged, or I can reuse your server, but I'm
wary of fork() on Win32 ...
Have fun,
-max