Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^2: Stopping an HTTP::Server::Simple server

by Corion (Pope)
on Jan 26, 2011 at 13:14 UTC ( #884335=note: print w/ replies, xml ) Need Help??

in reply to Re: Stopping an HTTP::Server::Simple server
in thread Stopping an HTTP::Server::Simple server

Maybe take a look at what you actually get in $pid before trying to kill it? .

Comment on Re^2: Stopping an HTTP::Server::Simple server
Download Code
Replies are listed 'Best First'.
Re^3: Stopping an HTTP::Server::Simple server
by textual (Novice) on Jan 26, 2011 at 14:19 UTC
    It's actually not defined.

      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.

        Another possibility is that the op is trying to launch the webserver in one process invocation, and then kill it in another. In which case $pid will have to be written to/from a file.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://884335]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2015-11-27 14:58 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (730 votes), past polls