CPAN, MacPorts and Eclipse: The hard-life

  • Posted on January 24, 2011 at 10:21

Developing machine configuration
My workstation is an Apple MacPro, running Snow Leopard. And I do my developing in Eclipse. For me undoubtedly the number one IDE. The Perl-support is really fantastic.
Unless you installed MacPorts!

Description
Although I was sure I installed the used CPAN-Modules, Eclipse kept complaining about not able to find them, blablabla….
Eclipse Error: Can't find CPAN Module

Cause
MacPorts installed it’s own Perl! Although not necessarily, it can happen easily. With a little bit of playing around in MacPorts, it’s quite probable than MacPorts installed it’s own Perl. Although it really isn’t a big issue in everyday use. (I never ran into any trouble, so far) it may result in Eclipse fooling you.
Because since my OS now by default uses the MacPorts version of Perl, it will also use the CPAN that’s installed by MacPorts. And, once again: It works just fine!
The only trouble is Eclipse. Eclipse, or actually E-P-I-C, still only looks in the default Perl search-paths.
So if you install a new module using CPAN when MacPorts has installed Perl, it will install that new module in the MacPorts-CPAN-Path, and not in the default OSX-CPAN-Path. That’s all!

Remedy
Just install your CPAN module also in the default OS X-Path using the absolute path.
Example:
$ sudo /usr/bin/cpan
cpan> install Archive::TarGzip
cpan> reload cpan
cpan> exit

Now restart your Eclipse….
Problem solved!

1 Comment on CPAN, MacPorts and Eclipse: The hard-life

  1. Josh says:

    Thanx, that really helped me out!

Leave a Reply