Problem:
  at the beggining of each request PERL5LIB is prepended to @INC in
  reverse order. E.g.:
     SetEnv PERL5LIB "one:two:three:four"
  results in this:
     @INC = ('four', 'three', 'two', 'one', '/usr....', '...');

Environment:
  Tested with perl 5.6.1, mod_perl 1.27 and 1.28

A patch is attached to src/modules/perl/perl_util.c that adds the PERL5LIB 
variables in the correct order.

Also attached is a test script and .htaccess that demonstrate the bug.

Notes:
  There might be a more elegent way of doing it.
  Apologies if the patch doesn't conform to the style guide - couldn't
      find it, and couldn't work out what indenting to use from looking.

--simonflk
--- src/modules/perl/perl_util.c-1.52   Fri Sep 12 17:16:03 2003
+++ src/modules/perl/perl_util.c        Mon Sep 29 18:34:43 2003
@@ -788,8 +788,12 @@
 
 void perl_inc_unshift(char *p)
 {
-    if(!p) return;
+    AV *tempinc = newAV();
+    I32 len;
+    int i;
 
+    if(!p) return;
+    
     while(p && *p) {
        SV *libdir = newSV(0);
        char *s;
@@ -804,9 +808,15 @@
            sv_setpv(libdir, p);
            p = Nullch;
        }
-       av_unshift(GvAV(incgv), 1);
-       av_store(GvAV(incgv), 0, libdir);
+           av_push(tempinc, libdir);
     }
+
+       len = av_len(tempinc);
+       av_unshift(GvAV(incgv), len + 1);
+       for (i = len; i >= 0; i--) {
+           SV **libdir = av_fetch(tempinc, i, 0);
+           av_store(GvAV(incgv), i, *libdir);
+       }
 }
 
 #ifdef PERL_MARK_WHERE

Attachment: test_perl5lib.pl
Description: Binary data

<FilesMatch test_perl5lib.pl>
    SetEnv PERL5LIB one:two:three:four
</FilesMatch>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to