Hi,
I have a slight problem. I want to know it is possible to use a variable to set part of the @INC path.
Although that's a little bit off topic and much more a perl question.
Yes. You can.
testlib/MYTEST.pm ----------------8<---------------- print "LOADED\n";
1; ----------------8<---------------- test-env.pl ----------------8<---------------- my $test = "testlib"; use lib $ENV{testlib}; use MYTEST;
print "ENDED\n"; ----------------8<----------------
----------------8<---------------- [EMAIL PROTECTED] tom]$ export testlib=testlib [EMAIL PROTECTED] tom]$ perl test.pl LOADED ENDED [EMAIL PROTECTED] tom]$ ----------------8<----------------
with a localy defined var I get the expected behaviour:
test-var.pl ----------------8<---------------- my $var = "testlib"; use lib $var; use MyModule; ----------------8<----------------
but you can work around this with begin-block:
test-var-begin.pl ----------------8<---------------- BEGIN { $main::test = "testlib"; } use strict; use lib $main::test; use MYTEST;
print "ENDED\n"; ----------------8<----------------
i.e. current code that works: use lib qw ( /usr/local/www/cvg-bin/ );
Is there a way to make it use an environment variable????
But you don't really need that because the actual working directory which is /usr/local/www/cgi-bin/ (apache cds to this and executes the cgi) is already in the lib-path. If you want to add other lib-dirs below that path e.g.
----------------8<---------------- /usr/local/www/cgi-bin/testlibs1 /usr/local/www/cgi-bin/testlibs2 ----------------8<----------------
a relative
----------------8<---------------- use lib qw( testlibs1 testlibs2 ); ----------------8<----------------
is sufficient.
Rgds /usr/local/www/cvg-bin/ Ian M
Reclaim Your Inbox! http://www.mozilla.org/products/thunderbird
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html