【问题标题】:Why I can't run perl from Textmate?为什么我不能从 Textmate 运行 perl?
【发布时间】:2011-03-23 18:29:54
【问题描述】:
#!/usr/bin/perl -w
use WWW::Mechanize;
print $WWW::Mechanize::VERSION."\n";

1) 从 Textmate 运行:

在@INC 中找不到 WWW/Mechanize.pm(@INC 包含: /Applications/TextMate.app/Contents/SharedSupport/Bundles/Perl.tmbundle/Support /库/Perl/Updates/5.10.0 /System/Library/Perl/5.10.0/darwin-thread-multi-2level /系统/库/Perl/5.10.0 /Library/Perl/5.10.0/darwin-thread-multi-2level /Library/Perl/5.10.0 /Network/Library/Perl/5.10.0/darwin-thread-multi-2level /Network/Library/Perl/5.10.0 /Network/Library/Perl /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level /System/Library/Perl/Extras/5.10.0 .) 在 /Users/xxx/Development/test.pl line 2. BEGIN failed--compilation 在 /Users/xxx/Development/test.pl 第 2 行中止。

2) 从终端运行:

sh-3.2# perl test.pl<br>
1.64

我该怎么办?

【问题讨论】:

  • 听起来可能是环境变量。

标签: perl textmate


【解决方案1】:

您似乎将 WWW::Mechanize 安装到了默认情况下不搜索的目录中。最有可能的是,您有一个 PERL5LIB 或其他环境变量将该目录添加到 Perl 的搜索路径中,并且由于某种原因未在 TextMate 提供的环境中设置。

尝试从 shell 和 TextMate 运行 perl -V,看看搜索路径有何不同。也可以添加

print "$INC{'WWW/Mechanize.pm'}\n";

到您的测试脚本以找出它的安装位置。

【讨论】:

  • 我现在知道这个问题了。我有 perl 两个版本 5.10.0 和 5.8.9。 Textmate 从 5.10.0 运行,但 shell 从 5.8.9 运行。如何更改 Textmate 以运行 5.8.9?
  • @ratchse: 把 /usr/bin/perl 改成 5.8.9 perl 的合适路径?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2010-10-14
  • 2023-03-05
  • 2010-09-27
  • 1970-01-01
  • 2010-10-21
  • 2020-10-18
  • 2016-08-15
相关资源
最近更新 更多