Commit | Line | Data |
18cc5c89 |
1 | package MooseX::Daemonize::SignalHandling; |
2 | use strict; # because Kwalitee is pedantic |
3 | use Moose::Role; |
4 | |
5 | our $VERSION = 0.01; |
6 | |
7 | # NOTE: |
8 | # this would be an excellent canidate for |
9 | # a parameterized role, since we would want |
10 | # to have the ability to specify which |
11 | # signals we want handled |
12 | |
13 | requires 'handle_signal'; |
14 | |
15 | sub setup_signals { |
16 | my $self = shift; |
17 | foreach my $signal (qw[ INT HUP ]) { |
18 | $SIG{$signal} = sub { $self->handle_signal($signal) }; |
19 | } |
20 | } |
21 | |
22 | 1; |
23 | |
24 | __END__ |
25 | |
26 | =pod |
27 | |
28 | =cut |