我使用Mac OS X 10.8,并希望在我的latex文件上运行latexindent.pl perl脚本.此脚本由
https://github.com/cmhughes/latexindent.plx生成.当我在latexfile上运行此脚本时,我收到以下错误消息:
Can't locate File/HomeDir.pm in @INC (@INC contains: /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.4/darwin-thread-multi-2level /Library/Perl/Updates/5.12.4 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at helloworld.pl line 10. BEGIN Failed--compilation aborted at helloworld.pl line 10.
似乎我在perl中缺少File :: HomeDir模块,所以我尝试使用以下方法下载它:
sudo perl -MCPAN -e’install File :: HomeDir’,
我收到以下错误:
无法通过包“File :: HomeDir”找到对象方法“install”.
我设法安装YAML :: Tiny包没有任何问题.
我试着跑:
1 #!/usr/bin/perl 2 3 use strict; 4 use warnings; 5 use FindBin; 6 use YAML::Tiny; 7 use File::Copy; 8 use File::Basename; 9 use Getopt::Std; 10 use File::HomeDir; 11 12 print "hello world"; 13 exit;
并获得与上面相同的错误消息…
有谁知道该怎么办?
解决方法
sudo perl -MCPAN -e 'install "File::HomeDir"' ^ ^