Module::Runtime - Invalid version format
in Meditations
2 direct replies — Read more / Contribute
|
by kcott
on Apr 25, 2014 at 07:33
|
A script that I've been running fairly regularly for the last three to four years unexpectedly died (Compilation failed) today.
I was unable to find a match for the error via Super Search.
I did find information in various other locations so I thought I'd gather them together here to save the next person some effort.
I've found a (somewhat dodgy) work-around which fixes my immediate problem (described below).
So, while I'm not actually asking for a solution, I'd be happy to hear about a better one.
I'm running Perl v5.18.1 on darwin-thread-multi-2level.
The error had two formats (from the same line of code).
Initially, I got:
Invalid version format (version required) at .../Module/Runtime.pm lin
+e 386.
After upgrading several modules, I got this:
Invalid version format (non-numeric data) at .../Module/Runtime.pm lin
+e 386.
I found Ovid had written about this in blogs.perl.org: Moose Dying With "Invalid version format (version required)". There's a fair amount of discussion following Ovid's post.
A bug report has been raised for this: Bug #92989 for Module-Runtime: bad if statement causes use_module() and use_package_optimistically() to fail
Here's the Changes file describing the changes in Module::Runtime v0.014 that caused this issue.
My initial attempts at a solution involved upgrading whatever modules I could find that seemed likely to be involved.
One of the issues raised in Ovid's blog and the bug report was the fact that the problematic modules were not reported.
I don't have a list of what I ugraded and it was a fairly diverse lot (some examples: MooseX::NonMoose, MooseX::ClassAttribute, Exception::Class::Base, version, et al).
At some point, the error message changed from "version required" to "non-numeric data", as stated above, but didn't get me any further.
I next tried rolling back to Module::Runtime v0.013. However, my version of Moose (2.1205) wanted Module::Runtime v0.014, so I reinstalled that.
Finally, [after making a copy] I manually edited .../Module/Runtime.pm, changing line 386, in use_package_optimistically(), from:
$name->VERSION($version) if @_ >= 2;
to
$name->VERSION($version) if @_ >= 2 && defined $version;
My old script was now running again!
[For anyone else choosing this path, there's a sub use_module($;$) {...} starting on line 346 which may need the same change.
I didn't need to change this so, wanting to make the least manual changes, I left it alone.]
|