use lib qw( /Q/perl ); package Watcher; use Net::Server; our (@ISA); @ISA = qw/Net::Server/; Watcher->run( log_level => 5, log_file => 'watcher.log', pid_file => 'watcher.pid', background => 1, ); sub post_configure_hook { my $s = shift; $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = sub { $s->server_close; }; $SIG{HUP} = sub { $s->sig_hup; }; my $done = 0; while (!done) { # work } $s->server_close; }