changelog 5.6 fix
[p5sagit/App-FatPacker.git] / t / pack.t
old mode 100755 (executable)
new mode 100644 (file)
index 6924f69..55e5104
--- a/t/pack.t
+++ b/t/pack.t
@@ -1,4 +1,3 @@
-#!perl
 use strict;
 use warnings FATAL => 'all';
 use Test::More qw(no_plan);
@@ -9,21 +8,25 @@ use File::Temp qw/tempdir/;
 use File::Spec;
 use Cwd;
 
-BEGIN { use_ok "App::FatPacker", "" }
+use App::FatPacker;
 
 my $keep = $ENV{'FATPACKER_KEEP_TESTDIR'};
-my $tempdir = tempdir($keep ? (CLEANUP => 0) : (CLEANUP => 1));
+
+my $cwd = getcwd;
+my $tempdir = tempdir('fatpacker-XXXXX', DIR => "$cwd/t", $keep ? (CLEANUP => 0) : (CLEANUP => 1));
 mkpath([<$tempdir/{lib,fatlib}/t/mod>]);
 
 for(<t/mod/*.pm>) {
   copy $_, "$tempdir/lib/$_" or die "copy failed: $!";
 }
 
-my $cwd = getcwd;
 chdir $tempdir;
 
 my $fp = App::FatPacker->new;
-my $temp_fh = File::Temp->new;
+my $packed_file = "$tempdir/script";
+open my $temp_fh, '>', $packed_file
+  or die "can't write to $packed_file: $!";
+
 select $temp_fh;
 $fp->script_command_file;
 print "1;\n";
@@ -34,7 +37,7 @@ close $temp_fh;
 chdir File::Spec->tmpdir;
 
 # Packed, now try using it:
-require $temp_fh;
+require $packed_file;
 
 {
   require t::mod::a;