I'm developing some web software. I'm testing on multiple apache/linux servers. I have a lib dir with my testing modules for each account, and for each cgi file, I have a use lib '/misc/home/path/lib';
So each account's cgi files need a diff use lib path. It's almost ok, I can run cli perl on these guys, still.. it's a pain.
Here's what I'm looking into..
- Is there a line to an .htaccess file that will include a path to seek lib in? So for each hosting account I could set that file up and forget the use lib in the cgi?
- Is there an init subroutine pre compile time that would by default look into the user's $home/lib dir for required modules?
Am I missing some more obvious solution? Keep in mind there is no root access.
udpate
Adding this to the .htaccess file:
SetEnv PERL5LIB '/path/you/want';
Works sometimes. It will not work if you use Taint mode, so.. no cigar.
Another interesting tidbit is Baselib.pm, but it requires BaseLib be installed .. so.. catch22 :).
It seemed intuitive to do use lib "$ENV{HOME}/lib";, but that is also not reliable. None of these accounts accept that.
One way that works with Taint:
BEGIN {
$ENV{DOCUMENT_ROOT}=~m/^([\w\-\/]+)$/i;
eval "use lib '$1/../lib';";
}
# this is unreliable:
#BEGIN {
# use lib do {
# $ENV{DOCUMENT_ROOT}=~m/^([\w\-\/]+)$/i;
# } . '/../lib';
#}
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.