Subject: | Changes to use_package_optimistically cause unnecessary failures for a number of modules |
This change is causing a number of modules that depend on Module::Runtime to fail:
If a I<VERSION> is specified, the C<VERSION> method of the loaded package is
called with the specified I<VERSION> as an argument. This normally serves
@@ -379,11 +377,13 @@ function work just like L</use_module>.
sub use_package_optimistically($;$) {
my($name, $version) = @_;
- check_module_name($name);
+ my $fn = module_notional_filename($name);
eval { local $SIG{__DIE__}; require_module($name); };
die $@ if $@ ne "" &&
- $@ !~ /\ACan't locate .+ at \Q@{[__FILE__]}\E line/s;
- $name->VERSION($version) if defined $version;
+ ($@ !~ /\ACan't locate \Q$fn\E .+ at \Q@{[__FILE__]}\E line/s ||
+ $@ =~ /^Compilation\ failed\ in\ require
+ \ at\ \Q@{[__FILE__]}\E\ line/xm);
+ $name->VERSION($version) if @_ >= 2;
return $name;
}
Reverting to
$name->VERSION($version) if defined $version;
instead of
$name->VERSION($version) if @_ >= 2;
Fixes the problem. You can replicate the problem this way:
cpanm https://cpan.metacpan.org/authors/id/D/DR/DRTECH/Elastic-Model-0.28.tar.gz