简体   繁体   中英

cpan says App::cpanminus is up to date but cpanm doesn't come up in /usr/bin

SHORT QUESTION

I've installed cpanm on Mac mini G4 Leopard 10.5.8 with perl-8.8.8 using /usr/bin/cpan -i App::cpanminus and then **sudo** /usr/bin/cpan -i App::cpanminus It said App::cpanminus is up to date. but no cpanm is available in /usr/bin or anywhere else.

NOTE I've looked up the question Can't locate module in @INC but CPAN says module is up to date and some others which seemed related to my case but they didn't help. Not much information is available in Google searches either.

LONG QUESTION

I've installed cpanm on Mac mini G4 Leopard 10.5.8 with perl-8.8.8 using /usr/bin/cpan -i App::cpanminus

All the downloading, extracting, compiling, etc went smoothly but at the last step, before installing it as (As Far As I Can Remember / AFAICR) /usr/bin/cpanm it stopped with a permission error (AFAICR) So I've repeated the same line with sudo:

~ $ sudo /usr/bin/cpan -i App::cpanminus

this time it said (again, AFAICR)

CPAN: Storable loaded ok
Going to read /Users/Mac/.cpan/Metadata
  Database was generated on Thu, 09 Dec 2021 18:17:02 GMT
App::cpanminus is up to date.

and it didn't place the cpanm into /usr/bin or any other PATH directory.

Note that I need to use solely perl, v5.8.8 because it is the only version compatible with some of the system level Perl applications.

When I did a search on the ~/.cpanm and the default Mac OS X Perl installation folder which is /System/Library/Perl no instance of cpanm was found. So I gather cpanm is not created at all.

I've deleted the /Users/Mac/.cpan and repeated the sudo install and it ended up with the same message above (again, AFAICR)

So I got stuck in this. I didn't do anything else other than deleting ~/.cpan

How to install cpan on this Mac?

Note 2 My question's title might not be best. Anyone is free to edit the title or the question.

A few things to note:

  • The cpan output should tell you where it installed things. Do you have the output? To try again, you can force install with cpan -f to see what happened.

  • The .cpan/ directory is just a work directory for CPAN.pm. However, you can go into its build/ directory and find the directory for the thing you are having trouble with to look at its build files. The Makefile will have settings such as INSTALLBIN and INSTALLSITEBIN (and some others) that notes where it decided to install things. Apple has typically set these to whatever they wanted for you already, so it's slightly different than the default perl behavior.

  • You've likely installed the cpanm script in one of perl's directories. Perl modules typically do not install into a common directory without you doing something special. There's likely a bin directory at the same level as the lib/ directory. See where you installed the module and then look for that bin/

$ cpan -D App::cpanminus
Loading internal logger. Log::Log4perl recommended for better logging
Reading '/Users/brian/.cpan/Metadata'
  Database was generated on Fri, 10 Dec 2021 19:29:02 GMT
App::cpanminus
-------------------------------------------------------------------------
    (no description)
    M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz
    /usr/local/perls/perl-5.34.0/lib/site_perl/5.34.0/App/cpanminus.pm
    Installed: 1.7044
    CPAN:      1.7044  up to date
    Tatsuhiko Miyagawa (MIYAGAWA)
    miyagawa@bulknews.net

$ ls -l /usr/local/perls/perl-5.34.0/bin/cpanm
-r-xr-xr-x  1 brian  wheel  302800 Jun 23 18:53 /usr/local/perls/perl-5.34.0/bin/cpanm
  • I like to leave the Perl programs in that bin directory and make links to them if I want them somewhere else in my path ( Make links to per version tools .

  • The -i switch to cpan is just extra typing. It's implied in almost every case where you would use it.

  • You get the permission error because you are using the system Perl and installing things into the directories it set up. Apple is pretty good about segregating that, but I don't remember how well they were doing that back then. A system update (heh, in your case unlikely;) might overwrite or delete your work. Many people use a separate, user-installed perl and pretend the system perl does not exist.

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