Boring has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am writing a Web service library in Perl. But I have a problem on the server_loop. I start the service by: $daemon->server_loop(); Is there a way to stop the service gracefully? Thanks.

Replies are listed 'Best First'.
Re: XML-RPC - How to stop server_loop?
by ikegami (Patriarch) on Nov 11, 2008 at 04:37 UTC

    Quote the docs:

    Because infinite loops requiring a HUP or KILL signal to terminate are generally in poor taste, the HTTP::Daemon side of this sets up a localized signal handler which causes an exit when triggered. By default, this is attached to the INT signal. If the Net::Server module is being used instead, it provides its own signal management.

    So press Ctrl-C, or use your system's kill command to send SIGINT to the process.

    If the Net::Server module is being used instead, it provides its own signal management.

    Reading Net::Server's docs, we learn that it listens for the INT, TERM and QUIT signals. So press Ctrl-C, or use your system's kill command to send one of those signals to the process.

      Hi, Thank you very much. Problem solved..:)