use tempdir, not cwd in tests
[gitmo/MooseX-Daemonize.git] / t / 31.with_pid_file_and_poe.t
index ae1c201..2fc888c 100644 (file)
@@ -3,13 +3,16 @@
 use strict;
 use warnings;
 
-use Cwd;
 use File::Spec::Functions;
 
 use Test::More;
 use Test::Exception;
 use Test::Moose;
 
+use File::Temp qw(tempdir);
+
+my $dir = tempdir( CLEANUP => 1 );
+
 BEGIN {
     eval 'use POE::Kernel;';
     plan skip_all => "POE required for this test" if $@;
@@ -20,10 +23,9 @@ BEGIN {
 
 use constant DEBUG => 0;
 
-my $CWD                = Cwd::cwd;
-my $PIDFILE            = catfile($CWD, 'test-app.pid');
-$ENV{MX_DAEMON_STDOUT} = catfile($CWD, 'Out.txt');
-$ENV{MX_DAEMON_STDERR} = catfile($CWD, 'Err.txt');
+my $PIDFILE            = catfile($dir, 'test-app.pid');
+$ENV{MX_DAEMON_STDOUT} = catfile($dir, 'Out.txt');
+$ENV{MX_DAEMON_STDERR} = catfile($dir, 'Err.txt');
 
 unlink $PIDFILE; # clean up anythinf leftover by last run