The only thing is the META.yml isnt available post install which is often when people want to be able to do version checks. I agree in principle that parsing for a special variable is yuky, but it does seem to have some positive features.
That's not really a problem, since we are only talking about checking the package version during the index phase. In this case, each module could still have the
use SVK::Version; our $VERSION = $SVK::VERSION;
line and it would DTRT when running the code post install. To my mind, the indexer should perform the following tests until one succeeds:
1) Extract the distro and examine the META.yml; if a line like
version: 1.23
exists, then apply that version to all modules in the distro that don't export their own $VERSION that isn't undef;
2) Examine the Makefile.PL or Build.PL and look for the version specifying stanza (being variously VERSION, VERSION_FROM, dist_version, or dist_version_from) and use that for the global version for all modules in the distro that don't already report a $VERSION;
3) Follow the current rules of loading each module in Safe.pm and extracting the $VERSION using the current regex.
This would have the appropriate behavior in all cases, AFAICT. It should be trivial to teach Module::Build to add the META.yml line automatically (if desired). By using the *distribution* version as a default $VERSION for any *module* which doesn't have it's own $VERSION, should mean that no module will be reported as undef (which is never useful), and should not be harmful for modules with independent $VERSION's for submodules (big modules like mod_perl).
If, at any time, a sub-module gets split off into it's own distribution, the author will have to start incrementing $VERSION from the last $VERSION that existed when it was part of a bundle (which is the right thing to do in any case).
Thoughts?
John
-- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4501 Forbes Boulevard Suite H Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5748
