Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Odd behavior of mod_perl's PerlSetEnv with PERL5LIB

Reply
Thread Tools

Odd behavior of mod_perl's PerlSetEnv with PERL5LIB

 
 
Tony Skelding
Guest
Posts: n/a
 
      04-26-2004
I am using a PerlSetEnv directive in order to have PERL5LIB set to a
directory list at request time. But the directories are being added
to @INC in reverse order.

For example, in my httpd.conf I have...

PerlSetEnv PERL5LIB foo:baryzzy

In my handler I have...

print "$_\n" for @INC;

The output I get is...

xyzzy
bar
foo
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0

However, if I simply set an environment variable in my shell, e.g.

$ export PERL5LIB=foo:baryzzy
$ perl -e 'print "$_\n" for @INC'

I get...

foo
bar
xyzzy
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
..
 
Reply With Quote
 
 
 
 
pkent
Guest
Posts: n/a
 
      04-27-2004
In article <(E-Mail Removed) >,
http://www.velocityreviews.com/forums/(E-Mail Removed) (Tony Skelding) wrote:

> I am using a PerlSetEnv directive in order to have PERL5LIB set to a
> directory list at request time. But the directories are being added
> to @INC in reverse order.


We've noticed this at work too. I believe it's a known issue and our
workaround is to do:

Set Env PERL5LIB lookherefirst:lookheresecond:lookherefirst

to cover both the CGI and mod_perl possibilities. Personally I have no
idea why it does it, and I certainly don't think it's desirable, but
you're not the only one to notice it

P

--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Odd behavior with odd code Michael Speer C Programming 33 02-18-2007 07:31 AM
perldoc use of PERL5LIB alexxx.magni@gmail.com Perl Misc 1 05-29-2006 02:55 PM
Managing PERL5LIB with multiple perl installation Jahagirdar Vijayvithal S Perl Misc 9 11-27-2004 04:45 PM
PERL5LIB - @INC - machine dependant subdirs Koos Pol Perl Misc 2 09-02-2004 06:43 AM
Taint mode and PERL5LIB kj Perl Misc 9 06-14-2004 08:24 PM



Advertisments