in reply to what should be in PERL5LIB after installing from source the 5.40.1 version on MacOS (am64)

If you install Perl by compiling from source, beginning with the Configure script, then you do not need anything in PERL5LIB. This script creates a makefile which contains all the information the Perl executable needs: The executable itself knows where to find the core libraries.

To debug your situation, I suggest that you deactivate all settings of PERL5LIB and then examine @INC for all your Perl executables:

perl -E 'say for @INC'

In your listings there are some occurrences of lib/lib/ which seems to indicate that modules have been installed into wrong places.

  • Comment on Re: what should be in PERL5LIB after installing from source the 5.40.1 version on MacOS (am64)
  • Download Code

Replies are listed 'Best First'.
Re^2: what should be in PERL5LIB after installing from source the 5.40.1 version on MacOS (am64)
by kwolcott (Acolyte) on Feb 22, 2025 at 19:02 UTC

    Thank you.

    I did the following:

    unset PERL5LIB

    for each version of Perl (5.38.2, 5.34.3, 5.40.1)

    perl -E 'say for @INC'

    The paths displayed then became part of my PERL5LIB, for each version.

    Regarding the "/lib/lib" path, I already noticed that having that was very odd and most likely incorrect. But I'm sure that it results from my (most likely incorrect) understanding of how to install Perl modules for each version of Perl. This is the method that I'm currently using; please correct me if I'm doing it wrong:

    /opt/perl/bin/cpanm -L /opt/perl/lib install "module"

    /opt/perl_5.40.1/bin/cpanm -L /opt/perl_5.40.1/lib install "module"

    I try not to install Perl modules where my MacPorts Perl is (/opt/local/lib/perl) as that is where MacPorts writes things...

    So if I uninstall all Perl modules that appear under a "lib/lib" path, and reinstall them, what syntax do I use to make sure that when I reinstall, the modules are placed in the correct location?

    Thank you.

      The paths displayed then became part of my PERL5LIB, for each version.

      But why? These are the paths Perl already knows about, there's no need to list them in PERL5LIB!

      If your cpanm programs have been installed properly, then each of them should be able to install into suitable locations without specifing any -L directory at all. If you run:

      cpanm --version

      ...then each cpanm will tell you which version of Perl it is running, where it is about to install, and where it is looking for libraries (should be mostly the same as where it is about to install, with exception of cpanm's own FatPacked stuff). These should be different for each cpanm, and different from where your MacPorts Perl is installing.

        Thanks again for clarification. That means that I confused cpanm on the intial installation of cpanm and it is perpetually confused. So I don't even need a PERL5LIB at all? I don't create or bundle my modules; everything comes with Perl or comes from CPAN, so it should know where to go...AWESOME!

        I use cpanm over cpan to install Perl modules, so my install install of cpanm via cpan must be correct, then I'll be on the correct path going forwards.

        Thanks, I'll work on that.