为什么我无法从 Textmate 运行 perl?
#!/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/更新/5.10.0 /系统/库/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 /网络/库/Perl/5.10.0/darwin-thread-multi-2level /网络/库/Perl/5.10.0 /网络/库/Perl /系统/库/Perl/Extras/5.10.0/darwin-thread-multi-2level /System/Library/Perl/Extras/5.10.0 .) 在 /Users/xxx/Development/test.pl第2行.BEGIN失败--编译 在 /Users/xxx/Development/test.pl 第 2 行中止。
。2) 从终端运行:
sh-3.2# perl test.pl<br>
1.64
我应该做什么?
#!/usr/bin/perl -w
use WWW::Mechanize;
print $WWW::Mechanize::VERSION."\n";
1) run from Textmate :
Can't locate WWW/Mechanize.pm in @INC (@INC contains:
/Applications/TextMate.app/Contents/SharedSupport/Bundles/Perl.tmbundle/Support
/Library/Perl/Updates/5.10.0
/System/Library/Perl/5.10.0/darwin-thread-multi-2level
/System/Library/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 .) at
/Users/xxx/Development/test.pl line 2. BEGIN failed--compilation
aborted at /Users/xxx/Development/test.pl line 2.
2) run from terminal:
sh-3.2# perl test.pl<br>
1.64
What should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎将 WWW::Mechanize 安装到默认情况下不搜索的目录中。最有可能的是,您有一个 PERL5LIB 或其他环境变量,将该目录添加到 Perl 的搜索路径中,但由于某种原因,该目录未在 TextMate 提供的环境中设置。
尝试从 shell 和 TextMate 运行
perl -V
并查看搜索路径有何不同。您还可以添加到测试脚本中以找出它的安装位置。
It appears you installed WWW::Mechanize into a directory that isn't searched by default. Most likely, you have a PERL5LIB or other environment variable that adds that directory to Perl's search path, and for some reason that's not set in the environment TextMate provides.
Try running
perl -V
from the shell and from TextMate and see what the difference in search paths is. You can also addto your test script to find out where it's installed.