简体   繁体   English

如何在系统级别将目录添加到Perl库路径?

[英]How can I add a directory to the Perl library path at the system level?

On a standard linux set up, where can I add a directory to the @INC variable? 在标准的linux设置中,我可以在哪里向@INC变量添加目录?

In the /etc/profile file, I added: /etc/profile文件中,我添加了:

 export PERLLIB=$PERLLIB:/foo/bar
 export PERL5LIB=$PERL5LIB:/foo/bar

Thanks 谢谢

You might also need to source your ~/.bashrc so that it rebuilds your environment, or log out and log back in, before this change takes effect. 在更改生效之前,您可能还需要使用〜/ .bashrc来重建环境,或者注销并重新登录。 At least this would be required if you made that change in your local ~/.bash_profile instead of system wide. 如果您在本地〜/ .bash_profile而不是系统范围内进行了更改,则至少需要这样做。

If you want every Perl script to have the additional library paths, you can re-compile Perl and specify the extra directories as part of the setup. 如果希望每个Perl脚本都有其他库路径,则可以重新编译Perl并在设置中指定额外的目录。 Other than that, you're stuck with the ad hoc methods as you describe. 除此之外,您仍然坚持使用您描述的临时方法。

Below command helps to fix this issue. 以下命令有助于解决此问题。 use lib "/usr/print"; 使用lib“/ usr / print”;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM