Search code examples
macosperlterminalcpanperl-module

Perl & CPAN upgrade help for OS X


Here is my problem. I am running OS X v10.7 (Lion) and want to set up an old Perl program I have written (was then using a Windows System with ActivePerl and then its ppm).

I read to use CPAN to install Perl modules (I am trying to install the Graph module). Whenever I tried to install it, it failed from a refused connection. Why? So I read that I should run the following to update CPAN and fix any broken links:

cpan> install Bundle:CPAN
cpan> reload cpan
cpan> index cpan
cpan> exit

However, after doing this I am stuck with this every time I try to do a CPAN install or upgrade:

New CPAN.pm version (v1.9800) available.
  [Currently running version is v1.9456]
  You might want to try
    install CPAN
    reload cpan
  to both upgrade CPAN.pm and run the new version without leaving
  the current session.

I was trying to use the default Perl stuff that is included in OS X rather than downloading ActivePerl. How do I fix CPAN and install the Graph Module?

PS: Running install CPAN and reload CPAN didn't do anything, but it generated the same message.

UPDATE I was able to upgrade to v1.9800 doing a manual install (make, install) through the terminal. But I am still unable to install the Graph Module. Here is what I am getting:

http://cloud.jjnford.com/3D1C1H4217222b1p1O3a

UPDATE - PROBLEM SOLVED I was finally able to solve the problem. I just moved the /User/jj/.cpan directory to User/jj/.cpan_bak and then reconfigured CPAN and the Graph Module installed with no fuss.


Solution

  • To solve this problem, do a manual upgrade of CPAN (apparently on OS X CPAN has trouble upgrading itself). You can download the source from here. After you have downloaded it uncompress it, create the make file from the Perl script, then run a make test, and finally if all goes well a make install.

    $> tar -xvxf CPAN-1.9800
    $> cd CPAN-1.9800
    $> perl Makefile.PL
    $> make
    $> make test
    $> make install
    

    Now get rid of your old CPAN configuration:

    $> mv ~/.cpan ~/.cpan.bak
    

    Now when you run CPAN from the terminal you should be prompted for the configuration again. Once this is complete and CPAN has started you will notice this:

    cpan shell -- CPAN exploration and modules installation (v1.9800)
    

    So CPAN is now upgraded and working, and in my case I installed the Graph Module:

    $cpan> install Graph
    

    And everything works fine. I hope this helps somebody.