#!/usr/bin/perl use warnings; use strict; use Net::DNS; use Net::DNS::Nameserver; sub replyhandler { 1 } sub gotint { my $sig = shift; die "die because I caught: SIG<$sig>\n"; } #$SIG{'INT'} = \&gotint; my $ns = Net::DNS::Nameserver->new( LocalAddr => '127.0.0.1', ReplyHandler => \&replyhandler); $ns->main_loop; while ( 1 ) { sleep 1 } END { print "oh no this is the END\n" }