in reply to Re^3: Stopping an HTTP::Server::Simple server
in thread Stopping an HTTP::Server::Simple server
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Stopping an HTTP::Server::Simple server
by tilly (Archbishop) on Jan 26, 2011 at 14:54 UTC | |
by textual (Novice) on Jan 26, 2011 at 16:38 UTC | |
by tilly (Archbishop) on Jan 26, 2011 at 16:56 UTC | |
by textual (Novice) on Jan 26, 2011 at 17:28 UTC | |
by Corion (Patriarch) on Jan 26, 2011 at 16:43 UTC |