http://www.perlmonks.org?node_id=548321

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

Why is signal handling so ugly? Surely there's a good reason? Is there a better way to do this? For instance, why do I have to define a SigSet object that I never do anything with?
my $sigset = POSIX::SigSet->new(); my $restart_action = POSIX::SigAction->new('restart',$sigset,POSIX::SA +_NODEFER()); my $end_action = POSIX::SigAction->new('end',$sigset,POSIX::SA_NODEFER +()); POSIX::sigaction(POSIX::SIGQUIT(), $end_action); POSIX::sigaction(POSIX::SIGHUP(), $restart_action); POSIX::sigaction(POSIX::SIGPIPE(), $restart_action); POSIX::sigaction(POSIX::SIGTERM(), $end_action); POSIX::sigaction(POSIX::SIGINT(), $restart_action); POSIX::sigaction(POSIX::SIGUSR1(), $end_action);