perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject [PATCH] Re: version syntax for mp2 [summary]
Date Tue, 04 Jan 2005 16:58:28 GMT
Stas Bekman wrote:
> OK so to sum things up:
> 
> On our side:
> ------------
> 
> in RC2 we move to:
> 
>   $mod_perl::VERSION = 1.099_019;
> 
> which will eventually become:
> 
>   $mod_perl::VERSION = 2.000_000;
> 
> we mangle Makefile.PL to convert x.yyy_zzz into x.y.z and pass it to:
> 
>  WriteMakefile(VERSION => "x.y.z").
> 
> so the package name is generated as mod_perl-x.y.z.tar.gz

OK, I think it's a good idea to start moving to the new version scheme in 
the RCs. But to get nice number formatting in certain cases, I've 
introduced a new scalar $mod_perl::VERSION_TRIPLET - (is it a good name?)
So now we get:

Configuring Apache/2.0.53-dev mod_perl/1.99.20-dev Perl/v5.8.6

Please consider this patch:

Index: Makefile.PL
===================================================================
--- Makefile.PL	(revision 123827)
+++ Makefile.PL	(working copy)
@@ -465,8 +465,7 @@
  sub set_modperl_version {
      require './lib/mod_perl.pm';

-    $VERSION = $mod_perl::VERSION;
-    $VERSION =~ s/(\d\d)(\d\d)$/$1_$2/;
+    $VERSION = $mod_perl::VERSION_TRIPLET;

      open my $fh, 'Changes';
      while (<$fh>) {
Index: lib/mod_perl.pm
===================================================================
--- lib/mod_perl.pm	(revision 123827)
+++ lib/mod_perl.pm	(working copy)
@@ -18,7 +18,22 @@
  use strict;

  BEGIN {
-    our $VERSION = "1.9920";
+    our $VERSION = "1.099020";
+    our $VERSION_TRIPLET;
+
+    if ($VERSION =~ /(\d+)\.(\d\d\d)(\d+)/) {
+        my $v1 = $1;
+        my $v2 = int $2;
+        my $v3 = int ($3 . "0" x (3 - length $3));
+        $VERSION_TRIPLET = "$v1.$v2.$v3";
+    }
+    else {
+        die "bad version: $VERSION";
+    }
+
+    # $VERSION        : "1.099020"
+    # int $VERSION    : 1.09902
+    # $VERSION_TRIPLET: 1.99.20
  }

  1;


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message