eliminate file::slurp dependency
Jonathan Rockway [Thu, 9 Nov 2006 06:53:18 +0000 (06:53 +0000)]
t/optional_lighttpd-fastcgi-non-root.t
t/optional_lighttpd-fastcgi.t

index d0a1183..5618014 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;
@@ -21,8 +20,6 @@ plan skip_all => 'Please set LIGHTTPD_BIN to run this test'
 
 plan tests => 1;
 
-require File::Slurp;
-
 # clean up
 rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
 
@@ -43,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",
@@ -72,9 +69,11 @@ fastcgi.server = (
         )
     )
 )
-};
+END
 
-File::Slurp::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: $!";
@@ -113,4 +112,4 @@ sub check_port {
     else {
         return 0;
     }
-}
\ No newline at end of file
+}
index 6b084cd..c6be094 100644 (file)
@@ -20,8 +20,6 @@ plan skip_all => 'Please set LIGHTTPD_BIN to run this test'
 
 plan tests => 1;
 
-require File::Slurp;
-
 # clean up
 rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
 
@@ -42,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",
@@ -71,9 +69,11 @@ fastcgi.server = (
         )
     )
 )
-};
+END
 
-File::Slurp::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: $!";
@@ -112,4 +112,4 @@ sub check_port {
     else {
         return 0;
     }
-}
\ No newline at end of file
+}