Subject: | Dynamic Version assignment in modules is unreliable for static analysis |
https://metacpan.org/source/SUNDQUIST/Google-Ads-AdWords-Client-4.11.0/lib/Google/Ads/AdWords/Deserializer.pm#L26
This line of code can't work for static analysis, as there will be no Google::Ads::AdWords::Constants in @INC
Worse, if there *is* a Google::Ads::AdWords::Constants in @INC, it will return *its* version, which may be *different* from the version under static analysis.
Its generally recommended to just hard-code these versions everywhere and then have a tool that synchronizes them as your release process.
However, presently, pointing Toolchain code (Module::Metadata) at your code simple does this:
Error evaling version line ' my $dummy = q# Hide from _packages_inside()
#; package Module::Metadata::_version::p3;
use version;
sub {
local $VERSION;
use Google::Ads::AdWords::Constants; our $VERSION = ${Google::Ads::AdWords::Constants::VERSION};;
return $VERSION if defined $VERSION;
return $Module::Metadata::_version::p3::VERSION;
};
' in /usr/lib64/perl5/vendor_perl/5.24.1/Google/Ads/AdWords/Deserializer.pm: Can't locate Google/Ads/AdWords/Constants.pm in @INC (you may need to install the Google::Ads::AdWords::Constants module) (@INC contains: /home/kent/perl5/perlbrew/perls/5.25.6-nossp-sdbm-nopmc/lib/site_perl/5.25.6/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.6-nossp-sdbm-nopmc/lib/site_perl/5.25.6 /home/kent/perl5/perlbrew/perls/5.25.6-nossp-sdbm-nopmc/lib/5.25.6/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.6-nossp-sdbm-nopmc/lib/5.25.6 .) at (eval 7) line 6, <$handle> line 26.
BEGIN failed--compilation aborted at (eval 7) line 6, <$handle> line 26.
Given this is how Module::Build populates the "provides" record: https://metacpan.org/source/SUNDQUIST/Google-Ads-AdWords-Client-4.11.0/META.json
I'm kinda surprised you haven't already hit problems here with this approach.
If anything, I think you got lucky that this code is here that will help you in the "developer of the dist" scenario : https://metacpan.org/source/ETHER/Module-Metadata-1.000033/lib/Module/Metadata.pm#L698-703
But that is unlikely to work for anyone else.