Farenji has asked for the wisdom of the Perl Monks concerning the following question:
I'm building a web application using perl, apache2 and mod_perl2. I'm experiencing some weird stuff. When I run the app from the console, it works fine. Also using perl cgi instead of mod_perl it works fine.
When I use mod_perl I get a not found error, on the first "use"d module. All the modules are in the same dir as the .pl script, /www/domain/cgi-bin/.
When I insert "use lib '/www/domain/cgi-bin';" in the script, the app works fine. But I rather not have hardcoded paths in my script, that's what config files are for.
I tried to overcome this issue by using FindBin and FindBin::Real, and using the $0 var. But without success. The bizarre thing is that the following works:
use lib "/www/domain/cgi-bin";
but the following does NOT work:
my $path = "/www/domain/cgi-bin"; use lib $path;
and that freaks me out.
Could anyone shed some light on this please?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strange issues with mod_perl and use lib
by Joost (Canon) on May 12, 2007 at 22:49 UTC | |
by ikegami (Patriarch) on May 13, 2007 at 01:44 UTC | |
by Joost (Canon) on May 17, 2007 at 22:08 UTC | |
by ikegami (Patriarch) on May 18, 2007 at 14:17 UTC | |
by Farenji (Novice) on May 12, 2007 at 23:38 UTC | |
|
Re: Strange issues with mod_perl and use lib
by perrin (Chancellor) on May 13, 2007 at 02:58 UTC | |
by Farenji (Novice) on May 13, 2007 at 10:39 UTC | |
|
Re: Strange issues with mod_perl and use lib
by RL (Monk) on May 13, 2007 at 06:09 UTC | |
|
Re: Strange issues with mod_perl and use lib
by Errto (Vicar) on May 13, 2007 at 05:28 UTC | |
|
Re: Strange issues with mod_perl and use lib
by Bro. Doug (Monk) on May 14, 2007 at 02:20 UTC |