PS> cpanm --self-upgrade
You are running cpanm from the path where your current perl won't install executables to.
Because of that, cpanm --self-upgrade won't upgrade the version of cpanm you're running.
cpanm path : C:\Programs\Strawberry\perl\site\bin\cpanm.bat
Install path : C:\Programs\STRAWB~1\perl\site\bin
It means you either installed cpanm globally with system perl, or use distro packages such
as rpm or apt-get, and you have to use them again to upgrade cpanm.
How do I either (a) make cpanm understand that these are the same paths, or (b) change the configured executable-installation path of Perl?
Instead of
cpanm --self-upgrade
, simply doing it ascpanm App::cpanminus
did the trick. (There was an error thatcpanm.bat.AAA
could not be renamed intocpanm.bat
, and that it would be renamed at next boot, but I just renamed it manually.)And to prevent potential other problems similar to this, I moved Perl to under
C:\Programs\berry\
(just to keep it under 8 letters), and editedlib/CPAN/Config.pm
,lib/Config_heavy.pl
,lib/Config.pm
to replaceSTRAWB~1
withberry
in every path.(The last two files here are as suggested by an answer in http://www.perlmonks.org/?node_id=680994 , and the first one is from
cpan
's output duringo conf
. )This path change unfortunately doesn't help with making cpanm's
--self-upgrade
work though, as it prints the same error message as in the question, with these shown as the differing paths now:Huh? Aren't they the same paths? Well, line 634 of https://metacpan.org/source/MIYAGAWA/App-cpanminus-1.7039/lib/App/cpanminus/fatscript.pm seems to be where this check is happening, and that line is assuming the
$install_base
won't contain special characters - but the backslashes in Windows paths are seen as special characters by Perl. So, Perl sees weird characters in the Install path that are different from the cpanm path, and declares it a non-match.Changing the regex match there to
/\Q$install_base\E/
would fix this, but an immediate solution as an end user is thecpanm App::cpanminus
one at the top.