开发者

Why I can't run perl from Textmate?

#!/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?


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 add

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

to your test script to find out where it's installed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜