9

我使用 Mac OS X 10.8,并想latexindent.pl perl在我的乳胶文件上运行脚本。该脚本由https://github.com/cmhughes/latexindent.plx制作。当我在 a 上运行此脚本时,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;         

并收到与上述相同的错误消息...

有谁知道该怎么做?

4

1 回答 1

14
sudo perl -MCPAN -e 'install "File::HomeDir"'
                             ^             ^
于 2013-10-25T14:01:59.430 回答