Hi all,

Julian Mehnle wrote:
> recently someone reported a problem with one of my modules that might
> indicate an issue with how CPAN, Module::Build's META.yml generator, and
> version.pm interact.  Please see the rt.cpan.org ticket included below.
>
> The Mail-SPF 2.004 distribution package was built with Module::Build
> 0.26, as that is the least outdated version available in Debian. :-(
>
> Is it likely that M::B 0.26's META.yml generator is badly interacting
> with version.pm-based version numbers (`use version; our $VERSION =
> qv('2.004');`) and CPAN is really expecting a version.pm-style version
> number in META.yml (here: "v2.004")?  Or why would CPAN report a version
> mismatch for "v2.004" vs "2.004000"?
>
> Is upgrading to M::B 0.28 and regenerating the distribution package (and
> its META.yml file) likely to help?

Oh, yeah, it seems that upgrading from M::B 0.26 to 0.2808 has helped.  
With 0.26, I couldn't get it to put anything other than numified versions 
("2.004000") in META.yml.  With 0.2808 (and my Mail::SPF code unchanged), 
I get "version: v2.005" in META.yml.  This should be sufficient for recent 
CPAN.pm releases to recognize identity of a locally installed 2.005 and a 
2.005 published on CPAN.

For anyone who has similar problems in the future and who reads this 
thread, I'd like to explain the cause of the problem explicitly (as I 
didn't understand it myself due to the various statements in this thread 
being too implicit).

    The problem I had is that my META.yml (generated by M::B 0.26) had
    version numbers of the form "2.004000", which is numerically correct,
    but in the new version.pm regime sorts between v2.3999 and v2.4001,
    as opposed to between v2.3.0 and v2.4.1 (as it was intended by me).

    Whereas old versions of CPAN.pm (<1.8x) perform a numerical comparison
    only, matching 2.004000 = 2.004, newer versions of CPAN.pm apply
    version.pm logic and compare as 2.004000 = v2.4000 >> v2.4 = 2.004,
    thus always reporting the version of the package on CPAN (whose
    META.yml is being read) as newer than what's locally installed.

    The solution is to upgrade M::B to at least 0.2802 (better 0.2805) so
    META.yml gets generated with correctly formatted version numbers (no
    erroneous trailing zeros) to fit the version.pm numbering regime.

However now I seem to be having another, related problem:

In Build.PL,

| build_requires  => {
|     Module => qv('0.002.1'),
| }

generates in META.yml:

| build_requires:
|   Module: !!perl/hash:version
|     original: 0.002.1
|     qv: 1
|     version:
|       - 0
|       - 2
|       - 1

Am I supposed to write version.pm-style version numbers literally in 
Build.PL as opposed to constructing version objects (and _can_ I do it or 
must I use numerical versions only)?  And/or is this an oversight in M::B?

Julian.

Attachment: pgpHqdoThb4iZ.pgp
Description: PGP signature

Reply via email to