8 use Test::More no_plan => 1;
13 use_ok('MooseX::Daemonize::Core');
14 use_ok('MooseX::Daemonize::Pid');
23 with 'MooseX::Daemonize::Core';
25 has 'daemon_pid' => (is => 'rw', isa => 'MooseX::Daemonize::Pid');
27 # capture the PID from the fork
28 around 'daemon_fork' => sub {
31 if (my $pid = $self->$next(@_)) {
33 MooseX::Daemonize::Pid->new(pid => $pid)
40 # tell it to ignore zombies ...
45 return unless $self->is_daemon;
46 # change to our local dir
47 # so that we can debug easier
49 # make it easy to find with ps
52 print "Got INT! Oh Noes!";
56 print "Hello from $$\n";
63 my $d = MyFooDaemon->new;
64 isa_ok($d, 'MyFooDaemon');
65 does_ok($d, 'MooseX::Daemonize::Core');
69 } '... successfully daemonized from (' . $$ . ')';
71 my $p = $d->daemon_pid;
72 isa_ok($p, 'MooseX::Daemonize::Pid');
74 ok($p->is_running, '... the daemon process is running (' . $p->pid . ')');
79 #diag `ps -x | grep test-app`;
87 #diag `ps -x | grep test-app`;
89 ok(!$p->is_running, '... the daemon process is no longer running (' . $p->pid . ')');