in reply to perlbrew and cpan

Can I use cpan inside a perlbrew context -- to install perl modules to a particular perlbrew perl install, only.

Yes, at least theoretically -- I've seen a few questions about perlbrew from folks who don't know to `which programname` to debug issues they encounter

Do I prefix the cpan install command with sudo? As in sudo perl -MCPAN -e'install Blah::blah'?

Are you root/sysadmin? sudo is for when a sysadmin is installing programs/perls/perl modules for everybody ... for day-to-day activities sysadmins don't login under the sysadmin account (root), so they sudo to do sysadmin tasks ...

perlbrew is all about you installing perls/modules in your home directory for yourself

sure its possible to shared perlbrew running as root, but then you wouldn't be asking these questions if this was the case :)

Can I actually use cpan to install modules in a particular perlbrew perl install only? Is that syntax without the sudo?

Yes, use perlbrew to switch current perl, then run cpan as normal (cpan Module::Name) and you'll install modules in the current perl

I'm on win32 so I don't perlbrew, but I'd look for a perlintro equivalent for perlbrew :)

Replies are listed 'Best First'.
Re^2: perlbrew and cpan (perlbrewintro)
by Anonymous Monk on Aug 07, 2014 at 07:33 UTC

    perlintro for perlbrew is App::perlbrew - Manage perl installations in your $HOME

    shorter intro

    Install it in $HOME
        curl -kL http://install.perlbrew.pl | bash

    Install important friend
        perlbrew install-cpanm

    Install the perls you want, like the latest of each minor stable version
        perlbrew install-multiple perl-5.8.9 perl-5.10.1 perl-5.12.5 perl-5.14.4 perl-5.16.3 perl-5.18.2 perl-5.20.0

    Install modules you want into all perlbrew perls in one command (aka run one command for all perlbrew perls)
        perlbrew exec cpanm Path::Tiny Mojolicious Task::Kensho

    Switch to perl-5.16.3 and make perl-5.16.3 your default perl (perl ... runs perl-5.16.3 )
        perlbrew switch perl-5.16.3

    Synchronize all installed perls modules (aka run one command for all perlbrew perls)
        perlbrew list-modules | perlbrew exec cpanm

Re^2: perlbrew and cpan
by Anonymous Monk on Aug 07, 2014 at 08:54 UTC

    Thx for your reply?

    The reason I am getting confused about sudo and the cpan command is because

  • I have never worked with non-system perl such as what perlbrew makes possible
  • It's not obvious to me that there is a cpan for each perlbrew install.
  • I cannot figure out how and where cpan will install the modules in an environment when there are multiple perls installed.
  • I actually have been googling all over the place in search for the answer. Seems like that added to my confusion.

    Thx

      I have never worked with non-system perl such as what perlbrew makes possible

      There's no difference between a distro-installed Perl and a perlbrew-installed Perl except in which directory they are installed.

      In fact, you can manage the system Perl with perlbrew simply by creating a symlink.

      cd "${PERLBREW_ROOT:-$HOME/perl5/perlbrew}" mkdir perls/system ln -s /usr/bin perls/system/bin

      It's not obvious to me that there is a cpan for each perlbrew install.

      Each perlbrew has its own modules and binaries.

      I cannot figure out how and where cpan will install the modules in an environment when there are multiple perls installed.

      cpan asks the perl executing it for that information.

      $ "${PERLBREW_ROOT:-$HOME/perl5/perlbrew}"/perls/5.20.0t/bin/perl -V:' +inst.*' installarchlib='/home/ikegami/usr/perlbrew/perls/5.20.0t/lib/5.20.0/x8 +6_64-linux-thread-multi'; installbin='/home/ikegami/usr/perlbrew/perls/5.20.0t/bin'; installhtml1dir=''; installhtml3dir=''; installman1dir='/home/ikegami/usr/perlbrew/perls/5.20.0t/man/man1'; installman3dir='/home/ikegami/usr/perlbrew/perls/5.20.0t/man/man3'; installprefix='/home/ikegami/usr/perlbrew/perls/5.20.0t'; installprefixexp='/home/ikegami/usr/perlbrew/perls/5.20.0t'; installprivlib='/home/ikegami/usr/perlbrew/perls/5.20.0t/lib/5.20.0'; installscript='/home/ikegami/usr/perlbrew/perls/5.20.0t/bin'; installsitearch='/home/ikegami/usr/perlbrew/perls/5.20.0t/lib/site_per +l/5.20.0/x86_64-linux-thread-multi'; installsitebin='/home/ikegami/usr/perlbrew/perls/5.20.0t/bin'; installsitehtml1dir=''; installsitehtml3dir=''; installsitelib='/home/ikegami/usr/perlbrew/perls/5.20.0t/lib/site_perl +/5.20.0'; installsiteman1dir='/home/ikegami/usr/perlbrew/perls/5.20.0t/man/man1' +; installsiteman3dir='/home/ikegami/usr/perlbrew/perls/5.20.0t/man/man3' +; installsitescript='/home/ikegami/usr/perlbrew/perls/5.20.0t/bin'; installstyle='lib'; installusrbinperl='undef'; installvendorarch=''; installvendorbin=''; installvendorhtml1dir=''; installvendorhtml3dir=''; installvendorlib=''; installvendorman1dir=''; installvendorman3dir=''; installvendorscript=''; $ "${PERLBREW_ROOT:-$HOME/perl5/perlbrew}"/perls/5.18.2t/bin/perl -V:' +inst.*' installarchlib='/home/ikegami/usr/perlbrew/perls/5.18.2t/lib/5.18.2/x8 +6_64-linux-thread-multi'; installbin='/home/ikegami/usr/perlbrew/perls/5.18.2t/bin'; installhtml1dir=''; installhtml3dir=''; installman1dir='/home/ikegami/usr/perlbrew/perls/5.18.2t/man/man1'; installman3dir='/home/ikegami/usr/perlbrew/perls/5.18.2t/man/man3'; installprefix='/home/ikegami/usr/perlbrew/perls/5.18.2t'; installprefixexp='/home/ikegami/usr/perlbrew/perls/5.18.2t'; installprivlib='/home/ikegami/usr/perlbrew/perls/5.18.2t/lib/5.18.2'; installscript='/home/ikegami/usr/perlbrew/perls/5.18.2t/bin'; installsitearch='/home/ikegami/usr/perlbrew/perls/5.18.2t/lib/site_per +l/5.18.2/x86_64-linux-thread-multi'; installsitebin='/home/ikegami/usr/perlbrew/perls/5.18.2t/bin'; installsitehtml1dir=''; installsitehtml3dir=''; installsitelib='/home/ikegami/usr/perlbrew/perls/5.18.2t/lib/site_perl +/5.18.2'; installsiteman1dir='/home/ikegami/usr/perlbrew/perls/5.18.2t/man/man1' +; installsiteman3dir='/home/ikegami/usr/perlbrew/perls/5.18.2t/man/man3' +; installsitescript='/home/ikegami/usr/perlbrew/perls/5.18.2t/bin'; installstyle='lib'; installusrbinperl='undef'; installvendorarch=''; installvendorbin=''; installvendorhtml1dir=''; installvendorhtml3dir=''; installvendorlib=''; installvendorman1dir=''; installvendorman3dir=''; installvendorscript='';