Author: stas
Date: Tue Dec  7 12:56:06 2004
New Revision: 111138

URL: http://svn.apache.org/viewcvs?view=rev&rev=111138
Log:
@INC shrinking efforts:
1) when adding $ServerRoot don't add the trailing / (as it ends up
twice when added by A-T w/o trailing /)
2) add $ServerRoot/lib/perl only if it actually exists

Modified:
   perl/modperl/trunk/Changes
   perl/modperl/trunk/src/modules/perl/mod_perl.c

Modified: perl/modperl/trunk/Changes
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&rev=111138&p1=perl/modperl/trunk/Changes&r1=111137&p2=perl/modperl/trunk/Changes&r2=111138
==============================================================================
--- perl/modperl/trunk/Changes  (original)
+++ perl/modperl/trunk/Changes  Tue Dec  7 12:56:06 2004
@@ -12,6 +12,11 @@
 
 =item 1.99_18-dev
 
[EMAIL PROTECTED] shrinking efforts: [Stas]
+1) when adding $ServerRoot don't add the trailing / (as it ends up
+twice when added by A-T w/o trailing /)
+2) add $ServerRoot/lib/perl only if it actually exists
+
 For static builds, we now run 'make clean' in httpd's source
 tree before running ./configure if the source tree has been
 configured before [Gozer]

Modified: perl/modperl/trunk/src/modules/perl/mod_perl.c
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/mod_perl.c?view=diff&rev=111138&p1=perl/modperl/trunk/src/modules/perl/mod_perl.c&r1=111137&p2=perl/modperl/trunk/src/modules/perl/mod_perl.c&r2=111138
==============================================================================
--- perl/modperl/trunk/src/modules/perl/mod_perl.c      (original)
+++ perl/modperl/trunk/src/modules/perl/mod_perl.c      Tue Dec  7 12:56:06 2004
@@ -286,10 +286,23 @@
 #endif
 
 #ifdef MP_COMPAT_1X
-    av_push(GvAV(PL_incgv),
-            newSVpv(ap_server_root_relative(p, ""), 0));
-    av_push(GvAV(PL_incgv),
-            newSVpv(ap_server_root_relative(p, "lib/perl"), 0));
+    {
+        char *path, *path1;
+        apr_finfo_t finfo;
+        /* 1) push @INC, $ServerRoot */
+        av_push(GvAV(PL_incgv), newSVpv(ap_server_root, 0));
+
+        /* 2) push @INC, $ServerRoot/lib/perl only if it exists */
+        apr_filepath_merge(&path, ap_server_root, "lib",
+                           APR_FILEPATH_NATIVE, p);
+        apr_filepath_merge(&path1, path, "perl",
+                           APR_FILEPATH_NATIVE, p);
+        if (APR_SUCCESS == apr_stat(&finfo, path1, APR_FINFO_TYPE, p)) {
+            if (finfo.filetype == APR_DIR) {
+                av_push(GvAV(PL_incgv), newSVpv(path1, 0));
+            }
+        }
+    }
 #endif /* MP_COMPAT_1X */
 
     /* things to be done only in the main server */

Reply via email to