eliminate file::slurp dependency
[catagits/Catalyst-Runtime.git] / t / optional_lighttpd-fastcgi.t
index ff7a2ea..c6be094 100644 (file)
@@ -4,7 +4,6 @@ use strict;
 use warnings;
 
 use File::Path;
-use File::Slurp qw(write_file);
 use FindBin;
 use IO::Socket;
 use Test::More;
@@ -15,9 +14,9 @@ plan skip_all => 'Catalyst::Devel required' if $@;
 eval "use File::Copy::Recursive";
 plan skip_all => 'File::Copy::Recursive required' if $@;
 
-my $lighttpd_bin = $ENV{LIGHTTPD_BIN} || 'lighttpd';
-plan skip_all => 'Cannot find lighttpd, please set LIGHTTPD_BIN'
-    unless -x $lighttpd_bin;
+my $lighttpd_bin = $ENV{LIGHTTPD_BIN};
+plan skip_all => 'Please set LIGHTTPD_BIN to run this test'
+    unless $lighttpd_bin && -x $lighttpd_bin;
 
 plan tests => 1;
 
@@ -41,7 +40,7 @@ my $port    = 8529;
 # Clean up docroot path
 $docroot =~ s{/t/..}{};
 
-my $conf = qq{
+my $conf = <<"END";
 # basic lighttpd config file for testing fcgi+catalyst
 server.modules = (
     "mod_access",
@@ -70,9 +69,11 @@ fastcgi.server = (
         )
     )
 )
-};
+END
 
-write_file "$docroot/lighttpd.conf", $conf;
+open(my $lightconf, '>', "$docroot/lighttpd.conf") or die "Can't open $docroot/lighttpd.conf: $!";
+print {$lightconf} $conf or die "Write error: $!";
+close $lightconf;
 
 my $pid = open my $lighttpd, "$lighttpd_bin -D -f $docroot/lighttpd.conf 2>&1 |" 
     or die "Unable to spawn lighttpd: $!";
@@ -111,4 +112,4 @@ sub check_port {
     else {
         return 0;
     }
-}
\ No newline at end of file
+}