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

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.

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

Replies are listed 'Best First'.
Re^3: what should be in PERL5LIB after installing from source the 5.40.1 version on MacOS (am64)
by haj (Vicar) on Feb 22, 2025 at 20:41 UTC
    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.

        So I don't even need a PERL5LIB at all?

        Correct.

        PERL_MM_OPT and PERL_MB_OPT should be unset. That way, modules will be installed in the default directory for the perl being used.

        And since you're installing modules in the default directory for the perl being used, you don't need to tell Perl where to look, so PERL5LIB should also be unset.

        Finally, make sure you used the correct perl (e.g. by using the cpan installed by it) when installing modules.

        If you have any further questions, please provide the output of perl -V:'inst.*' (capital "V") so I can provide concrete examples.