withpidfile should write its pidfile :)
Stevan Little [Mon, 3 Dec 2007 02:22:09 +0000 (02:22 +0000)]
lib/MooseX/Daemonize/WithPidFile.pm
t/30.with_pid_file.t

index 7bc0de8..1e17a13 100644 (file)
@@ -21,11 +21,13 @@ has pidfile => (
 );
 
 after 'daemonize' => sub {
+    my $self = shift;
     # NOTE:
     # make sure that we do not have 
     # any bad PID values stashed around
     # - SL
-    (shift)->pidfile->clear_pid
+    $self->pidfile->clear_pid;
+    $self->pidfile->write if $self->is_daemon;
 };
 
 1;
index 61414a7..e26d142 100644 (file)
@@ -41,8 +41,6 @@ $ENV{MX_DAEMON_STDERR} = catfile($CWD, 'Err.txt');
         $self->daemonize;
         return unless $self->is_daemon;
         
-        $self->pidfile->write;
-        
         # make it easy to find with ps
         $0 = 'test-app';
         $SIG{INT} = sub {