perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject [mp2] /dev/null on Win32
Date Fri, 07 Nov 2003 08:14:49 GMT
Hi,
  There's a couple of places where /dev/null is used
which, on Win32, will fail if a directory /dev isn't
present. This diff:
=====================================================
Index: lib/Apache/Build.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
retrieving revision 1.149
diff -u -r1.149 Build.pm
--- lib/Apache/Build.pm	5 Nov 2003 09:45:22 -0000	1.149
+++ lib/Apache/Build.pm	7 Nov 2003 08:11:55 -0000
@@ -6,7 +6,7 @@

 use Config;
 use Cwd ();
-use File::Spec::Functions qw(catfile catdir canonpath rel2abs);
+use File::Spec::Functions qw(catfile catdir canonpath rel2abs devnull);
 use File::Basename;
 use ExtUtils::Embed ();

@@ -127,7 +127,8 @@
         return defined $val ? ($val ? "$prefix/$val" : $prefix) : "";
     }

-    my $val = qx($apxs @_ 2>/dev/null);
+    my $devnull = devnull();
+    my $val = qx($apxs @_ 2>$devnull);
     chomp $val if defined $val; # apxs post-2.0.40 adds a new line

     unless ($val) {
Index: Apache-Test/lib/Apache/TestConfig.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.181
diff -u -r1.181 TestConfig.pm
--- Apache-Test/lib/Apache/TestConfig.pm	21 Oct 2003 22:09:41 -0000	1.181
+++ Apache-Test/lib/Apache/TestConfig.pm	7 Nov 2003 08:11:55 -0000
@@ -23,7 +23,7 @@
 use File::Basename qw(dirname);
 use File::Path ();
 use File::Spec::Functions qw(catfile abs2rel splitdir canonpath
-                             catdir file_name_is_absolute);
+                             catdir file_name_is_absolute devnull);
 use Cwd qw(fastcwd);

 use Apache::TestConfigPerl ();
@@ -1420,7 +1420,8 @@
 sub apxs {
     my($self, $q, $ok_fail) = @_;
     return unless $self->{APXS};
-    my $val = qx($self->{APXS} -q $q 2>/dev/null);
+    my $devnull = devnull();
+    my $val = qx($self->{APXS} -q $q 2>$devnull);
     chomp $val if defined $val; # apxs post-2.0.40 adds a new line
     unless ($val) {
         if ($ok_fail) {
==========================================================
uses devnull() of File::Spec to specify something that
will work in general on Win32 (just a file called "null").

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message