Commit | Line | Data |
---|---|---|
d9e417f4 | 1 | package MooseX::Daemonize::WithPidFile; |
2 | use strict; | |
3 | use Moose::Role; | |
4 | ||
d8985b7d | 5 | use MooseX::Daemonize::Pid::File; |
d9e417f4 | 6 | |
7 | our $VERSION = 0.01; | |
8 | ||
d02fc704 | 9 | with 'MooseX::Daemonize::Core'; |
10 | ||
d9e417f4 | 11 | requires 'init_pidfile'; |
12 | ||
13 | has pidfile => ( | |
d8985b7d | 14 | isa => 'MooseX::Daemonize::Pid::File', |
d9e417f4 | 15 | is => 'rw', |
16 | lazy => 1, | |
17 | required => 1, | |
18 | coerce => 1, | |
19 | predicate => 'has_pidfile', | |
20 | builder => 'init_pidfile', | |
21 | ); | |
22 | ||
d02fc704 | 23 | after 'daemonize' => sub { |
24 | # NOTE: | |
25 | # make sure that we do not have | |
26 | # any bad PID values stashed around | |
27 | # - SL | |
28 | (shift)->pidfile->clear_pid | |
29 | }; | |
30 | ||
d9e417f4 | 31 | 1; |
32 | ||
8ac4733f | 33 | __END__ |
34 | ||
35 | =pod | |
36 | ||
37 | =cut |