Subject: | Incorrectly reports version as 0 in some cases |
A good example of this can be seen by running Module::Metadata->package_versions_from_directory against the contents of the AnyEvent 7.15 distro.
It ends up reporting the version of AnyEvent::Log as "0" rather than undef. Internally, AnyEvent::Log has this (broken) $VERSION:
our $VERSION = $AnyEvent::VERSION;
Of course this is wrong, but I don't think reporting this as 0 is helpful. I'm not 100% sure why this is happening but I think it's because `version->parse(undef)` just treats this as 0.
Ideally, I'd suggest that Module::Metadata short circuit when parsing gives an undef and not even create a version object, but that break backwards compatibility.
Alternatively, you could add a new attribute to track whether the original version was undef and include that in the data structure returned by package_versions_from_directory.