You didn't say how you were invoking the server (a code sample would be nice), but if you are using the background method, then you'll have to store the $pid it returns so that you can kill the process later with the Perl kill command.
For example:
$pid = $HTTP_SERVER->background;
# do other stuff ...
# when you want to kill it..
kill 9, $pid;