Odd behavior of mod_perl's PerlSetEnv with PERL5LIB

Discussion in 'Perl Misc' started by Tony Skelding, Apr 26, 2004.

  1. 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:bar:xyzzy

    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:bar:xyzzy
    $ 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
    ..
    Tony Skelding, Apr 26, 2004
    #1
    1. Advertising

  2. Tony Skelding

    pkent Guest

    In article <>,
    (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
    pkent, Apr 27, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Speer

    Odd behavior with odd code

    Michael Speer, Feb 16, 2007, in forum: C Programming
    Replies:
    33
    Views:
    1,092
    Richard Heathfield
    Feb 18, 2007
  2. kj

    Taint mode and PERL5LIB

    kj, Jun 11, 2004, in forum: Perl Misc
    Replies:
    9
    Views:
    313
    Ben Morrow
    Jun 14, 2004
  3. Koos Pol
    Replies:
    2
    Views:
    116
    Koos Pol
    Sep 2, 2004
  4. Jahagirdar Vijayvithal S

    Managing PERL5LIB with multiple perl installation

    Jahagirdar Vijayvithal S, Nov 17, 2004, in forum: Perl Misc
    Replies:
    9
    Views:
    162
    Big and Blue
    Nov 27, 2004
  5. Replies:
    2
    Views:
    451
    Big and Blue
    Jan 25, 2006
Loading...

Share This Page