|We don't bite newbies here... much|
can't locate under mod_cgiby hakkr (Chaplain)
|on Aug 11, 2005 at 10:56 UTC||Need Help??|
hakkr has asked for the wisdom of the Perl Monks concerning the following question:
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 thanksupdate: fixed fatalsToBrowser typo