I just found the reason I had so many trouble re-emerging perl-core ebuilds today after having recompiled perl +ithreads.
* unpriv user has PERL5LIB set to ~/.perl/modules/lib/perl5
* when using su, the variable is still set
* when running emerge, the variable is still set
* if you happen to have bad/outdated/... perl modules, emerge may fail in many ways.
In such cases, that would help if perl-related ebuilds could warn about this.
Another option is to simply unset PERL5LIB before ebuild actually runs.
(In my case, I had an outdated version of JSON::PP in ~, so the "Writing Makefile" step warned, or even failed (eg: MP3-Info) and many other strange dependency issues)
Steps to Reproduce:
1. setup PERL5LIB
2. download an outdated version of JSON::PP using CPAN, in $PERL5LIB
3. emerge MP3-Info
Writing Makefile for MP3::Info
JSON::PP 2.27103 is not available
at /usr/lib64/perl5/vendor_perl/5.12.4/CPAN/Meta/Converter.pm line 22
at /usr/lib64/perl5/vendor_perl/5.12.4/ExtUtils/MM_Any.pm line 1278
* ERROR: dev-perl/MP3-Info-1.240.0 failed (configure phase):
emerge should ignore $PERL5LIB and succeed, or at least warn about this variable being set.
Reasonable idea, since this is a fair way of shooting yourself in the foot.
*** This bug has been marked as a duplicate of bug 543042 ***