strawberry-perlperlcpanm

Perl: How to deal with a duplicated modules installation?


I'm new with Perl and stumbled on a doubled modules installation.

I made a fresh installation of Strawbery Perl on Windows 10. After that, I tried to update all modules at once by using a command proposed in this answer; :

cpan-outdated -p | cpanm

Unfortunately, it appeared that probably the updates were installed on another location:

whichpm -a Mojolicious
C:\Strawberry\perl\site\lib\Mojolicious.pm
C:\Strawberry\perl\vendor\lib\Mojolicious.pm


whichpm -v Mojolicious
whichpm: WARNING: DUPLICATE module files found for 'Mojolicious':
  C:\Strawberry\perl\vendor\lib\Mojolicious.pm
Mojolicious     8.22    (non-core)      C:\Strawberry\perl\site\lib\Mojolicious.pm

How to deal whit that case?

How to prevent such cases in further updates?

perl -wE "say for @INC"

C:/Strawberry/perl/site/lib/MSWin32-x64-multi-thread
C:/Strawberry/perl/site/lib
C:/Strawberry/perl/vendor/lib
C:/Strawberry/perl/lib

Solution

  • Everything is working as expected.


    There are three sets of installation locations: core, vendor and site.

    The vendor directories are usually used by the package managers of linux distros, but it appears that Strawberry Perl includes a number of non-core modules in its distribution (including Mojolicious) and it places these in the vendor directories. This is proper.[1]

    The site directories are used for user-installed modules. So your upgraded Mojolicious was installed into the site directories. This is proper.

    (More on the differences here.)

    This is not a problem because the site directories are placed before the vendor directories in @INC, so the user-installed version of a module is found before the vendor-installed version.


    1. Using the site directories would probably also have been fine since Strawberry Perl doesn't provide a way of managing the distributions it bundles. But using the vendor directories is sure to be safe.