Perl的library设置
2013-04-27 08:47
183 查看
参考链接:
http://stackoverflow.com/questions/841785/how-do-i-include-a-perl-module-thats-in-a-different-directory
http://stackoverflow.com/questions/185114/how-do-i-use-a-perl-module-in-a-directory-not-in-inc
在Fedora/RHEL/CentOS中,perl 的library默认安装路径为:
[c-sharp]
view plaincopy
@INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .)
如果要使用自定义的perllib,就需要参考以下的设置了。
EDIT: Putting the right solution first, originally from this question. It's the only one that searches relative to the module directory:
There's many other ways that search for libraries relative to the current directory. You can invoke perl with the -I argument, passing the directory of the other module:
You can include a line near the top of your perl script:
You can modify the environment variable PERL5LIB before you run the script:
The push(@INC) strategy can also work, but it has to be wrapped in BEGIN{} to make sure that the push is run before the module search:
http://stackoverflow.com/questions/841785/how-do-i-include-a-perl-module-thats-in-a-different-directory
http://stackoverflow.com/questions/185114/how-do-i-use-a-perl-module-in-a-directory-not-in-inc
在Fedora/RHEL/CentOS中,perl 的library默认安装路径为:
[c-sharp]
view plaincopy
@INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .)
如果要使用自定义的perllib,就需要参考以下的设置了。
EDIT: Putting the right solution first, originally from this question. It's the only one that searches relative to the module directory:
use FindBin; # locate this script use lib "$FindBin::Bin/.."; # use the parent directory use yourlib;
There's many other ways that search for libraries relative to the current directory. You can invoke perl with the -I argument, passing the directory of the other module:
perl -I.. yourscript.pl
You can include a line near the top of your perl script:
use lib '..';
You can modify the environment variable PERL5LIB before you run the script:
export PERL5LIB=$PERL5LIB:..
The push(@INC) strategy can also work, but it has to be wrapped in BEGIN{} to make sure that the push is run before the module search:
BEGIN {push @INC, '..'} use yourlib;
相关文章推荐
- Perl的library设置
- [转]perl的INC设置
- 设置 Linux 的 LD_LIBRARY_PATH 变量
- 设置 Linux 的 LD_LIBRARY_PATH 变量
- linux 环境变量设置方法总结(PATH/LD_LIBRARY_PATH)
- 动态设置java.library.path
- WindowsServer2003 + IIS6.0 + ASP + NET + PHP + PERL + MSSQL + MYSQL 最新服务器安全设置技术实例
- WindowsServer2003 + IIS6.0 + ASP + NET + PHP + PERL + MSSQL + MYSQL 最新服务器安全设置技术实
- 设置 Linux 的 LD_LIBRARY_PATH 变量
- 如何设置Visual Studio的项目和解决方案目录(环境目录:Include, Library, Executable, etc.)
- Perl Socket设置有效的timeout
- PHP - Manual手册 - XVIII. CURL, Client URL Library Functions客户端URL库函数 - curl_setopt设置cURL传输的选项
- 重装VS之后的离线MSDN(HelpLibrary) 设置问题
- perl生成excel文档的格式设置
- LD_LIBRARY_PATH环境变量的设置
- Let’s Hook a Library Function(给库函数设置钩子)
- visualgdb 设置环境变量 LD_LIBRARY_PATH
- birt 的library进行公用数据库连接设置
- perl的INC设置分析
- 设置 Linux 的 LD_LIBRARY_PATH 变量