tags:

views:

48

answers:

1
#!/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
1.64

What should I do? Help me please.

+1  A: 

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.

cjm
I known the problem now.I have perl two version 5.10.0 and 5.8.9.Textmate run from 5.10.0 but shell run from 5.8.9.How can I change Textmate to run 5.8.9?
@ratchse: change the /usr/bin/perl to the appropriate path to the 5.8.9 perl?
ysth