2

I installed a module under cpanm, apparently incorrectly. It is visible and usable when running under system perl, but not under perlbrew. However, perlbrews cpanm is stating that module has been successfully installed. Best steps to take?

/Users/john/perl5/perlbrew/perls/perl-5.18.2/bin/perl
/Users/john/perl5/bin/cpanm
#!/usr/bin/perl
MM: INSTALL_BASE=/Users/john/perl5
MB: --install_base "/Users/john/perl5"

Note: .pl file contains following
#!/usr/bin/env perl

After perlbrew switch...

declare -x PERL5LIB="/Users/john/perl5/lib/perl5"
declare -x PERLBREW_BASHRC_VERSION="0.76"
declare -x PERLBREW_HOME="/Users/john/.perlbrew"
declare -x PERLBREW_MANPATH="/Users/john/perl5/perlbrew/perls/perl-5.18.2/man"
declare -x PERLBREW_PATH="/Users/john/perl5/perlbrew/bin:/Users/john/perl5/perlbrew/perls/perl-5.18.2/bin"
declare -x PERLBREW_PERL="perl-5.18.2"
declare -x PERLBREW_ROOT="/Users/john/perl5/perlbrew"
declare -x PERLBREW_VERSION="0.76"
declare -x PERL_LOCAL_LIB_ROOT="/Users/john/perl5"
declare -x PERL_MB_OPT="--install_base \"/Users/john/perl5\""
declare -x PERL_MM_OPT="INSTALL_BASE=/Users/john/perl5"

Link to sybase install with hombrew

Community
  • 1
  • 1
paulj
  • 327
  • 1
  • 9
  • 2
    Please provide the output of `which perl ; which cpanm ; head -n 1 "$( which cpanm )" ; printf 'MM: %s\n' "$PERL_MM_OPT" ; printf 'MB: %s\n' "$PERL_MB_OPT"` – ikegami Dec 01 '16 at 17:12
  • In perlbrew try the following. `$ cpanm --interactive -v App::cpanoutdated`, `$ cpan-outdated`, `$ cpanm --interactive -v App::CPAN::Fresh`. Then do `cpanm `. – Chankey Pathak Dec 01 '16 at 17:52
  • Check to see that the permissions are correct on the just installed files – KeepCalmAndCarryOn Dec 01 '16 at 21:46

2 Answers2

2

cpanm doesn't install any modules. It just runs the installer packaged with the distributions you want to install. Via the PERL_MM_OPT and PERL_MB_OPT env vars, you are instructing those installers to install the modules in the wrong location. Get rid of them.

ikegami
  • 367,544
  • 15
  • 269
  • 518
  • but wont the installs change location depending on which cpanm is used. I performed suggestion. Using perl under perlbrew, Can't locate DBD/Sybase.pm. Using system perl, all is fine. /Users/john/perl5/lib/perl5/darwin-thread-multi-2level/DBD/Sybase.pm. Want to make certain cpanm next install is for perlbrew copy – paulj Dec 07 '16 at 20:18
  • PERL5LIB="/Users/john/perl5/lib/perl5" This is the problem. How could I move files from here to ~/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/ – paulj Dec 07 '16 at 20:35
  • Thanks so much for the info. Not sure how I got to this point. – paulj Dec 07 '16 at 20:36
  • Re "*but wont the installs change location depending on which cpanm is used*", By default, the `perl` used will determine where the module is installed, but you are overriding this. – ikegami Dec 08 '16 at 03:42
  • Re "*How could I move files from here to ~/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/*" DON'T MOVE THEM. Just install the modules using the Perl for which you want them to be available. – ikegami Dec 08 '16 at 03:44
  • WOW! Thanks so much! – paulj Dec 08 '16 at 14:52
0

I had a similar problem and could not understand how to make cpanm install modules for the intended Perl. I had installed perlbrew via:

perlbrew --switch --notest install perl-stable

I thought that --switch would direct my usage to the new Perl, and I could see the new Perl was there via:

perlbrew exec perl -v | grep 'This is'

But installing modules with cpanm was not working (the modules wouldn't be found) when I would run my scripts via:

perlbrew exec perl myscript.pl

This which-version-of-perl post made me consider that maybe --switch had not had the effect I'd wanted. Running the following allowed cpanm to start installing to the intended Perl:

perlbrew switch perl-5.26.1
brigj
  • 3
  • 3