with qw(MooseX::Daemonize);
has filename => ( isa => 'Str', is => 'ro' );
- after start => sub { $_[0]->create_file( $_[0]->filename ) };
+
+ after start => sub {
+ my $self = shift;
+ $self->create_file( $self->filename )
+ if $self->is_daemon;
+ };
sub create_file {
my ( $self, $file ) = @_;
}
package main;
+use strict;
+use warnings;
use Cwd;
## Try to make sure we are in the test directory
filename => "$cwd/im_alive",
);
daemonize_ok( $app, 'child forked okay' );
-ok( -e $app->filename, "$file exists" );
+ok( -e $app->filename, "file exists" );
ok( $app->stop( no_exit => 1 ), 'app stopped' );
-ok( -e $app->pidfile == undef, 'pidfile gone' );
+ok( not(-e $app->pidfile) , 'pidfile gone' );
unlink( $app->filename );