问题原文
原帖链接 · Waveter · CC BY-SA 3.0
I have a perl script (test.pl). If I run this cript by command perl test.pl, it work as normal. However, when I run command sudo perl test.pl, the error below occurs:
Can't locate Log/Log4perl.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .)
I think it is strange, because I run script by root. Do you know why?
已采纳解答
原帖链接 · Khaled · CC BY-SA 3.0
You may get such an error if the module you are using is not installed which seems not our case here.
The other possibility is to have a different @INC array between the two users you are running as. You can verify this using:
$ perl -V
$ sudo perl -V
Compare the output to see the different paths in @INC. You can then fix the @INC by adding the missing path or install the needed module in one of the already defined paths.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
