alpha dists without the underscores

Eric Wilhelm <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.module-build
Message-ID <[email protected]>
Hi all,

Here's a patch of an idea I've been toying with:  the ability to publish 
an alpha version using the little-known "-TRIAL" string in the tarball 
name.

The trigger mechanism is to have the string "# ALPHA" on your $VERSION 
line.  That might have drawbacks, but is also 1) very simple and 2) 
leaves a permanent artifact in the deployed file (so you can read the 
source and say "oh, this was an alpha".)

Drawbacks?  It's assuming that "# ALPHA" is a comment -- but really what 
sort of crazy stuff are you doing with the $VERSION line where 
including the string "# ALPHA" in a non-alpha release is necessary and 
not confusing?

It is at least not more arbitrary than the "_" convention and would 
allow us to eliminate the whole eval($VERSION) thing as-recommended in 
David's post about versions (which, btw, triggers perl critic's wrath.)

For reason #2, I'm reluctant to do it with e.g. a command-line option or 
Build.PL parameter.  Some sort of artifact in the deployed .pm is very 
useful for debugging an installed module.

We talked about this a bit on IRC, but it hasn't been much farther than 
that.

Thoughts?

Thanks,
Eric


Index: lib/Module/Build/Base.pm
===================================================================
--- lib/Module/Build/Base.pm	(revision 13275)
+++ lib/Module/Build/Base.pm	(working copy)
@@ -1049,7 +1049,9 @@
     my $version_from = File::Spec->catfile( split( qr{/}, 
$dist_version_from ) );
     my $pm_info = Module::Build::ModuleInfo->new_from_file( 
$version_from )
       or die "Can't find file $version_from to determine version";
-    $p->{dist_version} = $self->normalize_version( 
$pm_info->version() );
+    my $v = $pm_info->version;
+    $p->{dist_version} = $self->normalize_version($v);
+    $p->{dist_version} .= eval {$v->{isalpha}} ? '-TRIAL' : '';
   }
 
   die ("Can't determine distribution version, must supply 
either 'dist_version',\n".
Index: lib/Module/Build/ModuleInfo.pm
===================================================================
--- lib/Module/Build/ModuleInfo.pm	(revision 13275)
+++ lib/Module/Build/ModuleInfo.pm	(working copy)
@@ -328,6 +328,7 @@
 
   # Bless it into our own version class
   $result = Module::Build::Version->new($result);
+  $result->{isalpha} = 1 if($line =~ m/# ALPHA/);
 
   return $result;
 }

-- 
"If you only know how to use a hammer, every problem begins to look like
a nail."
--Richard B. Johnson
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.