如何设置,其中的Perl会在Apache的httpd.conf文件模块上OSX?
How can I set where Perl looks for modules in Apache httpd.conf file on OSX?
我通过CPAN,这是在成功安装安装几个模块
I've installed several modules via CPAN, which were installed successfully in
/opt/local/lib/perl5/site_perl/5.8.9我可以通过的perldoc perllocal
如果我在命令行中运行的perl -V ,我得到(其它迪尔斯中):
If I run perl -V on the command line, I get (among other dirs):
@INC: /opt/local/lib/perl5/site_perl/5.8.9/darwin-2level /opt/local/lib/perl5/site_perl/5.8.9当我通过Apache运行perl脚本的CGI,但是,我得到的错误,我是模块使用 ING无法找到。被列入@INC显示目录列表中不符合我的本地Perl配置。
When I run a perl script as CGI via Apache, however, I get errors that the modules I'm useing can not be found. The list of dirs being included in @INC do not match my local perl configuration.
[error] [client 127.0.0.1] Can't locate Spreadsheet/ParseExcel.pm in @INC ( @INC contains: /Library/Perl/Updates/5.8.8 /System/Library/Perl/5.8.8/darwin-thread-multi-2level /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level ...如何运行的Perl作为OSX CGI时@INC越来越设置 - 和我怎么覆盖它。
How is @INC getting set when running perl as CGI on OSX - and how do I override it?
推荐答案的初始值 @公司很难codeD时,的perl 构建,但它可以在许多方面进行修改。这里最方便的是
The initial value of @INC is hardcoded when perl is built, but it can be modified in a number of ways. The most convenient here are
SetEnv PERL5LIB ...在Apache配置中,或者使用
from within the Apache configuration, or using
use lib qw( ... );从Perl脚本中。
from within the Perl script.
这就是说,它不是安全使用使用Perl 5.8.9用Perl 5.8.8(尽管周围的其他方法是安全的)安装的模块。更糟糕的是,人们似乎是一个螺纹Perl和另一种是不。修改 @公司根本就没有去上班。
That said, it's not safe to use modules installed using Perl 5.8.9 with Perl 5.8.8 (although the other way around is safe). Even worse, one appears to be a threaded Perl and the other one isn't. Modifying @INC is simply not going to work.
您需要使用相同的安装模块 perl的如要使用运行脚本,或者必须使用相同的运行脚本一个 perl的作为一个用来安装该模块。
You need to install the module using the same perl as the one you intend to use to run the script, or you must run the script using the same perl as the one used to install the module.
更多推荐
如何在OSX的httpd.conf覆盖@INC设置
发布评论