gugod / App-perlbrew

Manage perl installations in your $HOME
https://perlbrew.pl
Other
719 stars 216 forks source link

PERL5LIB setting breaks perlbrew #325

Open bolangi opened 11 years ago

bolangi commented 11 years ago

PERL5LIB adds directories to @INC used by perlbrew-managed perls. This can lead to wrong install locations (for example to ~/perl5/lib/perl5 when local::lib is used), or just broken behaviors when /usr/lib/perl5 gets added.

If perlbrew is to cater to non-expert users, I believe it should test for PERL5LIB on startup and issue a warning if the setting appears likely to break perlbrew. Or perhaps a warning for any non-null PERL5LIB value.

Thank you.

nilsboy commented 11 years ago

It would be great if perlbrew could handle the system perl like any perl installed by perlbrew.

When switching to system perl the paths ~/perl5/lib/perl5 could be added to PERL5LIB. And be removed when switching to a non-system perl. Or maybe completely ignore it and use a path like ~/perl5/perlbrew/perls/system-perl-5.18.0/.

This way we could always use perlbrew and wouldn't have to switch between perlbrew and local::lib.

What do you think of that?

Thanx.

gugod commented 10 years ago

I believe the only error that would be caused by having mixed values in PERL5LIB ( non-perlbrew-managed and perlbrew-managed) is that, a program would load its dependencies from a non-perlbrew-managed lib path. This can be easily solved by having perlbrew-managed PATHs in the beginning, and it has already being the case.

The other cases, which I am not sure if it is an error or not, is that the program will be able to load modules that are installed to a non-perlbrew-managed lib path.

The value of PERL5LIB does not effect module installation. The values of PERL_MB_OPT and PERL_MM_OPT do.

perlbrew used to support "switching to system perl" before -- but since we decided that having multi-user support is good, we ditch the symlink implementation, essentially discard the symlink to system perl. But "switching to system perl" is just equivalent to "perlbrew off". The only missing part is that we do not have local::lib that are associated with system perl, but managed via perlbrew.

We could certainly try to achieve this if anyone consider it to be valuable.

timbunce commented 10 years ago

See also #387.