Open rhalliday opened 7 years ago
This doesn't sound like the right solution to me at all (Module::Metadata should use less globals not more), but it might be the only solution :-/
This has been discussed before, but I believe we decided it was a bad idea. The current code unfortunately adds 'lib' to @INC
sometimes, but that can't be removed due to backwards compatibility.
PAUSE indexing works differently. It extracts a single version from each .pm file, and uses it for every package that if finds in the file.
Hmm, I couldn't think of a way to do it without modifying @INC in some way. Modifying the way that Module::Metadata specifies the versions of all the packages in one file has the potential to cause more issues than it fixes.
There's a lot of 'wtf's in lib/WWW/Scripter.pm... without comments to explain the author's intent in some of the constructs, I would lean towards "we cannot support this". There is no reason to have a $VERSION declared in secondary packages in a file, as it's not possible to mix and match versions, and secondary packages should only be used internally (otherwise, they should be split out into separate files so they can be loaded separately).
WWW::Scripter defines multiple packages in the same file, some of those packages contain a block of text that Module::Metadata tries to evaluate to get a version. I've added t/lib/0_1/Bar.pm which contains the whole offending block but essentially the line that Module::Metadata tries to evaluate is "use WWW::Scripter; use WWW::Scripter; $VERSION = $WWW'Scripter'VERSION;"
When using Carton to install WWW::Scripter this causes Module::Metadata to error with "Can't find module". This is due all the modules being installed in a local/lib directory. If we add $self->{inc} to @INC before evaluating the version line then Perl looks in the right places for the WWW::Scripter module.