miyagawa / cpanminus

cpanminus - get, unpack, build and install modules from CPAN
http://cpanmin.us
746 stars 213 forks source link

cpanm --look doesnt preserve perlbrew use in subshell. #656

Closed demerphq closed 1 year ago

demerphq commented 1 year ago

Something like this recipe:

perlbrew use latest_blead
cpanm --look Some::Module

will not respect the "use latest_blead", the command must be reissued in the sub-shell. Eg,

$ which perl
/home/yorton/perl5/perlbrew/perls/blead_SA/bin/perl
$ perlbrew use latest_blead
$ which perl
/home/yorton/perl5/perlbrew/perls/latest_blead/bin/perl
$ cpanm --look App::pl
--> Working on App::pl
Fetching http://www.cpan.org/authors/id/P/PF/PFEIFFER/App-pl-0.91.0.tgz ... OK
Entering /home/yorton/.cpanm/work/1674720117.971321/App-pl-0.91.0 with /bin/bash
At home.
$ which perl
/home/yorton/perl5/perlbrew/perls/perl-5.34.1/bin/perl
$ exit
$ which perl
/home/yorton/perl5/perlbrew/perls/latest_blead/bin/perl

Apologies if this has already been reported. Thank you for cpanm, lovely tool in general.

miyagawa commented 1 year ago

I am guessing that your bashrc (or equivalent for your shell) is reverting the perlbrew setting to your default. iirc this doesn't happen with plenv.

demerphq commented 1 year ago

Thanks for the feedback. I was under the impression perlbrew and cpanm were more closely linked than they are. Your prognosis makes perfect sense. I guess there is nothing for you to do here. I'll close the ticket. Sorry for the noise. I should have done more research before filing, butI figured I should report this directly since I mentioned it in a p5p post today (cced you). My bad.