This patch attempts to improve Apache::MyConfig. It:

* adds other configuration arguments for a later reuse. Please see if I've
missed some possible arguments. I wish there was a way to ask MakeMaker to
return all the arguments passed to Makefile.PL... @ARGV is not good since
it's being mangled. Hmm, may be catching it at the beginning of
Makefile.PL? Since otherwise one has to hardcode all the possible args.

* makes addition of new (hardcoded) arguments easier (no explicit hash
definition)

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/

--- /Makefile.PL.orig   Fri Feb  9 11:43:10 2001
+++ Makefile.PL Fri Feb  9 11:48:09 2001
@@ -1977,9 +1977,23 @@
 EOS
     }
 
-    local *FH;
-# writing Configuration to Apache::MyConfig
+# preparing and writing Configuration to Apache::MyConfig
+    my %my_config = %callback_hooks;
+    my @other_hooks = qw(APACHE_SRC SSL_BASE APXS PERL_USELARGEFILES
+                         PERL_TRACE PERL_DEBUG APACI_ARGS APACHE_PREFIX
+                         DO_HTTPD NO_HTTPD PREP_HTTPD USE_APACI
+                         APACHE_HEADER_INSTALL PERL_STATIC_EXTS );
+    {
+        no strict 'refs';
+        $my_config{$_} = ${$_} for @other_hooks;
+    }
+
+    my $my_config_dump = join ",\n",
+        map { qq{'$_' => } .
+              ($my_config{$_} =~ /^\d+$/ ? $my_config{$_} : qq{'$my_config{$_}'})
+            } sort keys %my_config;
 
+    local *FH;
     open FH, '>lib/Apache/MyConfig.pm'  ||
        die "Can't open lib/Apache/MyConfig.pm: $!";
     print FH <<EOT;
@@ -1989,20 +2003,8 @@
 package Apache::MyConfig;
 
 %Setup = (
-   'Apache_Src' => \'$APACHE_SRC\',
-   'SSL_BASE' => \'$SSL_BASE\',
-   'APXS' => \'$WITH_APXS\',
-   'PERL_USELARGEFILES' => \'$PERL_USELARGEFILES\',
-EOT
-
-  foreach my $key (sort @callback_hooks) {
-    print FH "   \'$key\' => \'$callback_hooks{$key}\',\n";
-  }
-
-  print FH <<EOT;
-   $string
+$my_config_dump
 );
-
 1;
 
 __END__
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to