Add $self->{inc} to @INC whilst evaluating version#26
Add $self->{inc} to @INC whilst evaluating version#26rhalliday wants to merge 1 commit intoPerl-Toolchain-Gang:masterfrom
Conversation
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. 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". If we add $self->{inc} to @inc before
evaluating the version line then Perl looks in the right places for the
WWW::Scripter module.
|
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 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. |
|
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.