|Subject:||Makefile.PL fails when no '.' in @INC ( Can't locate inc/Module/Package.pm in @INC )|
Perl 5.25.11 removes '.' from the default @INC, and this breaks `use inc::Module::Package` due to not being able to assume ./inc/Module/Package.pm is in the @INC load path.
This is not a complete end-of-the-world problem, as Perl provides a temporary workaround variable (PERL_USE_UNSAFE_INC=1) affected users can set that restores '.' in @INC temporarily to "just work", and for end users convenience, CPAN.pm, cpanm, prove and TAP::Harness ( called in `make test` ) set this variable, creating an illusion during installation that this problem is not there
However, this should still be considered a serious issue, as many types of end users don't get the luxury afforded by the CPAN-and-friends hacks ( vendors, hand installers, people running `perl t/foo.t` ), and this workaround is scheduled to be removed in the future.
And due to aforementioned temporary conveniences and hacks, you should intentionally defeat said hacks when testing you've fixed this, by explicitly setting PERL_USE_UNSAFE_INC=0 in your environment prior to running Makefile.PL and tests, and ensuring to perform said tests on Perl 5.25.11 or newer
Recommended solution for Makefile.PL is simply injecting a `use lib '.'` statement in Makefile.PL before the `use inc::Module::Package` statement.
Raw Error Observed:
Can't locate inc/Module/Package.pm in @INC (you may need to install the inc::Module::Package module) (@INC contains: /home/kent/perl5/perlbrew/perls/5.25.12-nossp-sip13-nopmc-nodot/lib/site_perl/5.25.12/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.12-nossp-sip13-nopmc-nodot/lib/site_perl/5.25.12 /home/kent/perl5/perlbrew/perls/5.25.12-nossp-sip13-nopmc-nodot/lib/5.25.12/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.12-nossp-sip13-nopmc-nodot/lib/5.25.12) at Makefile.PL line 2.
BEGIN failed--compilation aborted at Makefile.PL line 2.
- CPAN firstname.lastname@example.org
- Gentoo Perl Maintainer email@example.com ( firstname.lastname@example.org )