BEGIN {
use_ok('MooseX::Daemonize::Core');
- use_ok('MooseX::Daemonize::Pid');
+ use_ok('MooseX::Daemonize::Pid');
}
use constant DEBUG => 0;
{
package MyFooDaemon;
use Moose;
-
+
with 'MooseX::Daemonize::Core';
-
+
has 'daemon_pid' => (is => 'rw', isa => 'MooseX::Daemonize::Pid');
-
+
# capture the PID from the fork
around 'daemon_fork' => sub {
my $next = shift;
);
}
};
-
+
sub start {
- my $self = shift;
+ my $self = shift;
# tell it to ignore zombies ...
- $self->daemonize(
- ignore_zombies => 1,
- no_double_fork => 1,
- );
+ $self->ignore_zombies( 1 );
+ $self->no_double_fork( 1 );
+ $self->daemonize;
return unless $self->is_daemon;
# change to our local dir
# so that we can debug easier
chdir $dir;
# make it easy to find with ps
$0 = 'test-app';
- $SIG{INT} = sub {
- print "Got INT! Oh Noes!";
+ $SIG{INT} = sub {
+ print "Got INT! Oh Noes!";
exit;
- };
+ };
while (1) {
- print "Hello from $$\n";
- sleep(10);
+ print "Hello from $$\n";
+ sleep(10);
}
exit;
}