perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Flack" ...@flacks.net>
Subject Re: [PATCH] add PERL5LIB to @INC in the correct order
Date Fri, 03 Oct 2003 11:57:32 GMT
On Tue, 30 Sep 2003 11:49:57 -0700, Stas Bekman wrote
> Simon Flack wrote:
> > 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.
> 
> Thank you Simon.
> 
> It's a bug indeed. However I think we can't change this 
> functionality in mp1 at this point, since it'll break other people's 
> setups which rely on the current behavior. We probably should 
> document this mis-feature.

Stas,

That's fine. Although the behaviour has changed as recently as v1.27 where 
previously the contents of PERL5LIB were pushed onto @INC rather that 
unshifted.

The problem with the current behaviour is that you need a special case when 
running under mod_perl. In our set up, we test our scripts as CGIs and with 
Apache::Registry and it's nice to be able to set PERL5LIB in one place rather 
than two.
 
> Please use this as a workaround:
> 
> my $PERL5LIB = "one:two:three:four";
> unshift @INC, $_ for reverse split /:/, $PERL5LIB;

We've done something like this, that works in mod_perl and non-mod_perl 
environments:

  SetEnv PERL5LIB one:two:three:four:three:two:one

Of course we have to explain that with a comment in case someone comes along 
in a few months and thinks "I'll clean up that duplication"

We'll probably just apply the patch to our departmental servers and document 
that in the build instructions.

Thanks

--simonflk

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


Mime
View raw message