removed signal handling, cause it was not very useful, and then made WithPidFile...
[gitmo/MooseX-Daemonize.git] / lib / MooseX / Daemonize / WithPidFile.pm
1 package MooseX::Daemonize::WithPidFile;
2 use strict;
3 use Moose::Role;
4
5 use MooseX::Daemonize::Pid::File;
6
7 our $VERSION = 0.01;
8
9 with 'MooseX::Daemonize::Core';
10
11 requires 'init_pidfile';
12
13 has pidfile => (
14     isa       => 'MooseX::Daemonize::Pid::File',
15     is        => 'rw',
16     lazy      => 1,
17     required  => 1,
18     coerce    => 1,
19     predicate => 'has_pidfile',
20     builder   => 'init_pidfile',
21 );
22
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
31 1;
32
33 __END__
34
35 =pod
36
37 =cut