简体   繁体   中英

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.

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.

I know this was solved, but do consider using "cpanminus" instead next time. It's faster and could save you a lot of hassle. You can either install App:cpanminus using cpanminus (see: App::cpanminus ):

curl -L http://cpanmin.us | perl - --sudo App::cpanminus

And then to install any module and its dependencies simply run:

cpanm <module>

Alternatively you could use it directly from the web:

curl -L http://cpanmin.us | perl - --sudo <module>

I use it on my OS X Lion, and it works perfectly :)

I have a fresh Mac OS X Lion and I updated CPAN without problems.

Installing XCode is not enough. Make, gcc, g++ are not installed by default.

To install them, one has to: Start XCode, go to XCode->Preferences->Downloads and install component named "Command Line Tools".

Please excuse me for replying to this old post.

I had the same issue as the OP. Once I corrected the command to contain two colons instead of one (ie - Bundle::CPAN vs Bundle:CPAN), it worked as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM