我寫了一個shell腳本,做的東西上Centos64運行在一個shell腳本
在這個腳本結束Perl腳本,我運行一個Perl腳本。
它工作正常,如根(我已經安裝了Perl模塊),但是當我運行它作爲一個系統用戶
我得到的消息:
./UserActivityReport.sh Can't locate MIME/Lite.pm in @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 .) at /optreports/sendmailUAR.pl line 3. BEGIN failed--compilation aborted at /opt/reports/sendmailUAR.pl line 3.
彷彿模塊是未安裝的用戶...
我在shell腳本使用以下命令運行該腳本:
/usr/bin/perl /opt/reports/sendmailUAR.pl
爲什麼沒有運行?
注意:我無法與系統用戶安裝perl模塊。
=== 你去那裏:
perl -MMIME::Lite -MData::Dumper -e'print Dumper \%INC'
$VAR1 = {
're.pm' => '/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/re.pm',
'warnings/register.pm' => '/usr/lib/perl5/5.8.8/warnings/register.pm',
'XSLoader.pm' => '/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/XSLoader.pm',
'IO/Handle.pm' => '/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/IO/Handle.pm',
'MIME/Types.pm' => '/usr/lib/perl5/site_perl/5.8.8/MIME/Types.pm',
'SelectSaver.pm' => '/usr/lib/perl5/5.8.8/SelectSaver.pm',
'IO/Seekable.pm' => '/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/IO/Seekable.pm',
'warnings.pm' => '/usr/lib/perl5/5.8.8/warnings.pm',
'File/Basename.pm' => '/usr/lib/perl5/5.8.8/File/Basename.pm',
'Fcntl.pm' => '/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/Fcntl.pm',
'IO.pm' => '/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/IO.pm',
'Symbol.pm' => '/usr/lib/perl5/5.8.8/Symbol.pm',
'bytes.pm' => '/usr/lib/perl5/5.8.8/bytes.pm',
'MIME/Type.pm' => '/usr/lib/perl5/site_perl/5.8.8/MIME/Type.pm',
'Carp.pm' => '/usr/lib/perl5/5.8.8/Carp.pm',
'MIME/Base64.pm' => '/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/MIME/Base64.pm',
'Exporter/Heavy.pm' => '/usr/lib/perl5/5.8.8/Exporter/Heavy.pm',
'File/Spec/Unix.pm' => '/usr/lib/perl5/5.8.8/File/Spec/Unix.pm',
'FileHandle.pm' => '/usr/lib/perl5/5.8.8/FileHandle.pm',
'strict.pm' => '/usr/lib/perl5/5.8.8/strict.pm',
'Exporter.pm' => '/usr/lib/perl5/5.8.8/Exporter.pm',
'vars.pm' => '/usr/lib/perl5/5.8.8/vars.pm',
'MIME/Lite.pm' => '/usr/lib/perl5/site_perl/5.8.8/MIME/Lite.pm',
'MIME/QuotedPrint.pm' => '/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/MIME/QuotedPrint.pm',
'File/Spec.pm' => '/usr/lib/perl5/5.8.8/File/Spec.pm',
'overload.pm' => '/usr/lib/perl5/5.8.8/overload.pm',
'IO/File.pm' => '/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/IO/File.pm',
'Mail/Address.pm' => '/usr/lib/perl5/site_perl/5.8.8/Mail/Address.pm',
'Data/Dumper.pm' => '/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/Data/Dumper.pm'
以root身份運行'perl -MMIME :: Lite -MData :: Dumper -e'print Dumper \% INC''並在這裏輸出。 – salva
好吧,我添加了它。 – Rgonomike
系統用戶的@INC裏似乎沒有'/ usr/lib/perl5/site_perl/5.8.8 /'。看看:http:// stackoverflow。com/questions/2526804/how-is-perls-inc-constructed-aka-what-are-all-ways-of-affect-where- –