Randy Kobes wrote:
In lib/Apache/Build.pm, some tries are made to find
apxs and apr-config, and success is tested using -x $try.
For this test to succeed on Win32 a .bat extension is
needed. The following diff:
=======================================================
Index: lib/Apache/Build.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
retrieving revision 1.151
diff -u -r1.151 Build.pm
--- lib/Apache/Build.pm 15 Dec 2003 05:29:35 -0000      1.151
+++ lib/Apache/Build.pm 15 Dec 2003 16:32:53 -0000
@@ -102,7 +102,8 @@
     my $apxs;
     my @trys = ($Apache::Build::APXS,
                 $self->{MP_APXS},
-                $ENV{MP_APXS});
+                $ENV{MP_APXS},
+                catfile $self->{MP_AP_PREFIX}, 'bin', 'apxs');

could this be committed separately? Since it's a different change...


     unless (IS_MOD_PERL_BUILD) {
         #if we are building mod_perl via apxs, apxs should already be known
@@ -114,8 +115,10 @@
         '/usr/local/apache/bin/apxs';
     }

-    for (@trys) {
-        next unless ($apxs = $_);
+    my $ext = WIN32 ? '.bat' : '';
+    for my $try (@trys) {
+        $try .= $ext if ($try and defined $ext and $try !~ /$ext$/);
+        next unless ($apxs = $try);

$ext is well defined ('.bat' : ''), why would you check if it's defined? I'd say:


$try .= $ext if $try and $try !~ /$ext$/;

         chomp $apxs;
         last if -x $apxs;
     }
@@ -831,8 +834,10 @@
                 if exists $self->{MP_AP_PREFIX} and -d $self->{MP_AP_PREFIX};
         }

+        my $ext = WIN32 ? '.bat' : '';
         for (@tries) {
             my $try = catfile $_, "apr-config";
+            $try .= $ext if ($try and defined $ext and $try !~ /$ext$/);

here $try is also well defined (catfile), so all you need is:


$try .= $ext if $try !~ /$ext$/;

             next unless -x $try;
             $self->{apr_config_path} = $try;

now, in both cases why not adjust the code that fills @tries in? which should be as simple as:


if (WIN32) {
    my $ext = ".bat";
    @tries = map { $_ . $ext unless $_ =~ /$ext$/} @tries;
}

This is untested.

But you don't have to change the code that does the actual testing, which keeps it simple and it's easy to see that WIN32 has a special case, instead of messing with the end code.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to