I like to declare module versions like so:

   use version; our $VERSION = qv('v1.2.3');

The problem with this comes with the distmeta action.  The version object gets 
stringified and not numified before putting it into META.yml, which needs to 
contain actual numbers.  So here's a quick hack that seems to work for me.  
Before I put together a proper patch, is this the correct approach?  Could 
these things be objects but not version.pm objects?


Index: lib/Module/Build/Base.pm
===================================================================
--- lib/Module/Build/Base.pm    (revision 12514)
+++ lib/Module/Build/Base.pm    (working copy)
@@ -3613,7 +3613,10 @@
    die "ERROR: Missing required field '$_' for META.yml\n"
      unless defined($node->{$name}) && length($node->{$name});
  }
-  $node->{version} = '' . $node->{version}; # Stringify version objects
+  my $version = $node->{version};
+  if (ref $version) {
+    $node->{version} = $version->numify();
+  }

  if (defined( my $l = $self->license )) {
    die "Unknown license string '$l'"
@@ -3719,6 +3722,9 @@
      next if grep /^_/, split( /::/, $package ); # private package, ignore

      my $version = $pm_info->version( $package );
+      if (ref $version) {
+        $version = $version->numify();
+      }

      if ( $package eq $prime_package ) {
        if ( exists( $prime{$package} ) ) {

Reply via email to