in reply to (solved) combining perlbrew and cpanm

The cpanm installed by the command you found is a good solution. Essentially the problem you had is that when you install (properly distributed) executable files from CPAN, such as cpanm, its shebang is rewritten so that it executes with the Perl it was installed to. This is important, because only the Perl it is installed to is guaranteed to have its prerequisites installed at that point, among other things. It turns out this isn't very important for cpanm though as it's pure-Perl and has no non-core dependencies, so you can instead just download the fatpacked version from https://cpanmin.us and run it with any Perl you like, to install things to that Perl: wget -qO /path/to/cpanm.pl https://cpanmin.us; /path/to/perl /path/to/cpanm.pl $args The install-cpanm command uses a similar method. My strategy is to grab this fatpacked cpanm, and use it to install App::cpanminus to each Perl I work with.

Replies are listed 'Best First'.
Re^2: (solved) combining perlbrew and cpanm
by Your Mother (Archbishop) on Sep 18, 2018 at 23:10 UTC

    How about some example code to go with all that? Links next time would be nice too. Citations about “fatpacked,” guaranteed prereqs, “properly distributed”, and how such is able to rewrite the shebang would also be appreciated.

      I'm not sure what example to provide, but I'm pretty link-wary on this website since it randomly makes posts not work. Let's try: App::FatPacker, cpanm. The shebang is rewritten by the installer as long as it was originally a single path containing 'perl' - this is what I meant by 'properly distributed'. Unfortunately #!/usr/bin/env perl, while appropriate for any standalone scripts you distribute outside of CPAN, will not be rewritten due to an old bug.