Monks,

I have spent many hours wrestling this problem.

I have source installs of mod_perl 1.29, apache 1.3.33 and perl 5.8.7.
I have a directory that I wish to add to @INC.

Under mod_perl this works fine, I just PerlSetEnv /dir in httpd.conf and that's it everything works.

The problem occurs whenever I run my scripts under mod_cgi they cannot find any code in my custom lib.

Everything works fine at command line and I have exported PERL5LIB as an environment variable in /etc/profile.

When I use CGI::Carp qw/fatalsToBrowser/;

I get 'Can't locate in @INC', @INC is then shown with my /dir proudly listed at the front laughing at me.

I have tried the follwing:
1. 'SetEnv /dir' in httpd.conf - @INC shows my dir in the error message but still i get the can't locate message.
2. use lib '/dir'; This has no affect on @INC, the script still dies when it hits a use statement.
3. unshift @INC, '/dir'; This also has no affect the script dies on use statement if I remove the use statement and print @INC step 2 and 3 show my dir as present.

This is driving me nuts,how can 'use lib' be ignored and unshifting onto @INC be ignored. I have tried using Module::Locate and printed %INC both to no avail. The only way it works is if I move my dir into the built in path /usr/local/lib/perl5/5.8.7/i686-linux /usr/local/lib/perl5/5.8.7 /usr/local/lib/perl5/site_perl/5.8.7/i686-linux /usr/local/lib/perl5/site_perl/5.8.7/ /usr/local/lib/perl5/site_perl/

I am using this same setup on other servers with the only difference being the perl version. the dir permissions are 755. This must be something todo with apache or taint but I am now at a loss what to try. grateful for any ideas thanks

update: fixed fatalsToBrowser typo

In reply to can't locate under mod_cgi by hakkr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.