In Net::DNS 1.42 $ns->main_loop no longer loops. Use current methods for starting the server, wait for SIGTERM then cleanup child processes using $ns->stop_server(), then remove the pid file.