This is surprising, as HTTP::Server::Simple should then die in the parent with Can't fork: ..., which you should have seen:
sub background {
my $self = shift;
my $child = fork;
croak "Can't fork: $!" unless defined($child);
return $child if $child;
srand(); # after a fork, we need to reset the random seed
# or we'll get the same numbers in both branches
if ( $^O !~ /MSWin32/ ) {
require POSIX;
POSIX::setsid()
or croak "Can't start a new session: $!";
}
$self->run(@_); # should never return
exit; # just to be sure
}
So, either you're looking at a webserver that is not the webserver you launched, or the $pid is not where you store the information.
If you're trying to kill the child from within the child, $pid will also not be defined there (see fork). To kill yourself, use $$ as the pid.