Can't use three part version number for CPAN modules
arc_of_descent
created: 2006-01-04 06:34:40

This might serve as a reminder not to use three part version numbers for your CPAN modules.

After reading Perl Best Practices and considering the advantage of using three part version numbers (like 0.0.3) over the usual CPAN version numbers like (0.03), and also that I use three part version numbers for my other non-CPAN modules and scripts, I decided to upload my latest module revision as 0.0.3, the earlier version being 0.01

Here's what I got from the PAUSE indexer report. A status of "Falling revision number". The Indexer was somehow converting "0.0.3" to "0.000003", and that being less than "0.01", hence the error.

Update:

The module actually does display on the CPAN web site with version 0.0.3, so I'm not sure why I got that message from the PAUSE indexer. Additionally, 0.0.3 does not show up in my 02packages.details.txt in my .cpan directory.

I guess the best I can do, is delete the 0.01 version from my CPAN dir, let it vanish from the index, and then upload version 0.0.3


--
Rohan

Re: Can't use three part version number for CPAN modules
created: 2006-01-04 06:37:38
Here's what I got from the PAUSE indexer report. A status of "Falling revision number". The Indexer was somehow converting "0.0.3" to "0.000003", and that being less than "0.01", hence the error.

Code?

Take a look at things like Class::Std do it.

Re^2: Can't use three part version number for CPAN modules
created: 2006-01-04 06:48:07

In [ID://503983], [ID://107600] mentions that the PAUSE indexer does not handle the [CPAN://version] module correctly, so I'm not sure if its changed now. The VERSION variable in my module was set as

our $VERSION = "0.0.3";

--
Rohan

Re^3: Can't use three part version number for CPAN modules
created: 2006-01-04 07:17:11
our $VERSION = "0.0.3";

If you're following [TheDamian]'s advice you'll want to use the [cpan://version] module instead of a plain string. Something like:

use version; our $VERSION = qv( '0.0.0' );

and adding [cpan://version] to your modules prerequisites. NOTE: it's important to keep the use version on the same line since many modules grep out the line with $VERSION and eval it to get the version number out.

Re: Can't use three part version number for CPAN modules
created: 2006-01-04 07:02:36

More accurately, this would be a warning not to mix two-part and three-part version numbers. version works fine if you use three-part version numbers exclusively.


A computer is a state machine. Threads are for people who can't program state machines. -- Alan Cox
Re: Can't use three part version number for CPAN modules
created: 2006-01-04 07:05:20

Dear Rohan

My simple and not quite finished module got in OK yesterday: Catalyst::Plugin::Email::Page

I used module::starter::PBP to create it.

Although castaway made me change it today to Catalyst-Plugin-Email-Page-0.2 and now I use our $VERSION = '0.2';

Walking the road to enlightenment... I found a penguin and a camel on the way.....
Fancy a yourname@perl.me.uk? Just ask!!!
Re: Can't use three part version number for CPAN modules
created: 2006-01-04 07:07:15
See node 295636 and node 352282

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.
Re: Can't use three part version number for CPAN modules
xdg
created: 2006-01-04 07:32:22

You may also want to look at Seeking thoughts on version numbers in modules. I personally don't think version.pm and 3 part version strings are ready for prime time quite yet.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: Can't use three part version number for CPAN modules
created: 2006-01-04 08:00:04
I, too, gave up on 3 part version strings after problems with CPAN, PAUSE, ExtUtils::MakeMaker and so on. Additionally, I ensure that my version numbers always have 3 significant digits because trailing zeros tend to get truncated with things like 'make dist'. Thus, I go from 0.09 to 0.11, and 1.99 to 2.01. This seems to make everything happy and sane.

Remember: There's always one more bug.
Re: Can't use three part version number for CPAN modules
created: 2006-01-04 08:04:50
Here's what I got from the PAUSE indexer report. A status of "Falling revision number". The Indexer was somehow converting "0.0.3" to "0.000003", and that being less than "0.01", hence the error.
While I think that converting "0.0.3" to "0.000003" isn't the correct way (and the PAUSE indexer contains more 'surprises', for instance, it thinks that "0.2" is a newer version than "0.11", because it considers "0.2" to be a short hand for "0.002" and "0.11" a short hand for "0.011" - not that this is an idea of PAUSE - Andreas is just doing what perl is doing itself), I think that most people will consider "0.01" to be a newer release than "0.0.3". "0.01" reads as major release 0, minor release 1. "0.0.3" reads as major release 0, minor release 0, patch level 3. I don't think you should interpret Damian's suggestion to use three part version numbers as an invitation to just take your two part version number and insert an extra dot. I would consider "0.01" and "0.1.0" to be equivalent, and hence, "0.0.3" to be an older release.

I suggest you keep 0.01 in your CPAN dir, and name your new release "0.1.3", or "0.2.3", and count from there.

Perl --((8:>*
Re^2: Can't use three part version number for CPAN modules
created: 2006-01-04 08:48:09
I think that most people will consider "0.01" to be a newer release than "0.0.3". "0.01" reads as major release 0, minor release 1. "0.0.3" reads as major release 0, minor release 0, patch level 3. I don't think you should interpret Damian's suggestion to use three part version numbers as an invitation to just take your two part version number and insert an extra dot. I would consider "0.01" and "0.1.0" to be equivalent, and hence, "0.0.3" to be an older release.

Thanks for the insight.


--
Rohan

Re^2: Can't use three part version number for CPAN modules
created: 2006-01-04 18:56:43
> While I think that converting "0.0.3" to "0.000003"
> isn't the correct way

It's the official way. Please read perldoc version.

> it thinks that "0.2" is a newer version than "0.11",
> because it considers "0.2" to be a short hand for "0.002"
> and "0.11"

Wrong. It considers 0.2 > 0.11 because perl does:

% perl -le 'print 0.2 > 0.11 ? "T" : "F"'
T

> most people will consider "0.01" to be a newer release
> than "0.0.3".

Thank you! I couldn't agree more!

> I would consider "0.01" and "0.1.0" to be equivalent

Sorry, the factor 1000 has been chosen to be the perl mapping for each dot in the version string.

> I suggest you keep 0.01 in your CPAN dir, and name your
> new release "0.1.3", or "0.2.3"

Sorry, it would have to be at least a little bit more than 0.10.0, because 0.10.0 is the equivalent of 0.010000 and as such is exactly numerically equal to 0.01.
Re: Can't use three part version number for CPAN modules
created: 2006-01-04 09:11:37

I don't know what TheDamian is recommending, but you might find Re: Versioning modules in a package worth a read.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Can't use three part version number for CPAN modules (don't)
tye
created: 2006-01-04 12:15:56

I have to say that using v-string-like version "numbers" is wishful thinking not a "best practice". It might be a best practice in another few years. Right now, it is just asking for problems, many of which will be problems not for you but for the people who try to use your module and thus are the types of problems that it is even more important to avoid.

My suggestion to you is to upload version 0.0101 or 0.0104 or 0.0204 or 0.02004 or such of your module. Treating the purpose of the segments of your chosen version "number" too strictly is a mistake. You appear to be quite reluctant to increment the middle part of your version number; please don't be. What is important about version "numbers":

  • The sort order is obvious to both people and to programs
  • Two different versions must have different version numbers
  • Version numbers "increase"

Other considerations should be treated gingerly. I've seen tons of examples of people trying to assign meaning to certain aspects of version numbers that result in problems. For example, there is a CPAN module that tried to make the integer part of the version number match the release year. A minor "oops" followed by a too-hasty (IMHO) correction means that this module is now version 9999.xxx.

I've previous written versions as:

use vars qw( $VERSION );
$VERSION= 1.01_03;

But I worry that the "_" being there in the Perl source code but not there when you do:

print $My::Module::VERSION

could be a source for confusion that I can avoid (note that I don't consider using "our" to be a best practice either).

Version numbers like "1.2.3" are harder for computers to sort and are less clear how to handle in Perl. The advantages of "1.2.3" over 1.02003 are quite minor, as far as I can tell. So I much prefer version numbers be used that are trivial for both computers and people to sort and that are obviously just numbers (but sort correctly as strings as well) and so how to deal with them is obvious as well.

(No, I have not yet had a module make it to version 10.xxx. I doubt I'll have this "problem" to address. Though, if I do, I might jump from 4.x to 500.x then from 699.x to 7000.x, etc. and just rename the module if I get close to version 999999.xx :)

Update: I forgot to mention to avoid trailing 0s on the latter parts of your version numbers. So if you go with x.yyzzz, then avoid (skip over) version numbers like 1.00012, 1.01010, 1.10020.

- [tye]        

Re: Can't use three part version number for CPAN modules
created: 2006-01-06 11:26:17

This might serve as a reminder not to use three part version numbers for your CPAN modules.

It should actually act as a reminder that I need to remember to watch out for these threads, so that things don't deteriorate to this point. :(

What TheDamian is suggesting in Perl Best Practices is to use a structured version object, via the version module. All version comparisons DTRT and there aren't any suprises like can be caused with v-strings. As an aside, I was as thunderstruck as anyone to see this recommendation when he made it during his Best Practices Perl talk in 2004. I wasn't convinced that version.pm was ready for prime time yet. I was even more stunned to discover this past summer that Module-Starter-PBP already contained the recommended

use version; our $VERSION = qv("1.2.3");

stanza. I alerted Andreas to this fact and went back to check in some changes to version.pm based on his tests.

Contrary to what is said in this thread (and in fact in the 0.50 version.POD), Andreas has updated the CPAN indexer to correctly parse version objects and add the value to the index files as a number. That distinction is important since both CPAN and CPANPLUS expect the $VERSION column in the index file to be a floating point number (the old style $VERSION). The version.pm module contains logic to convert between a floating point and a multi-dot version object in an internally consistant manner.

Your problem is that you didn't read the version POD (or you did and my poor documentation skills prevented you from understanding) and tried to mix Numeric Versions with Extended Versions (to use the terminology I've recently adopted). The problem is that your existing CPAN release was done like this:

our $VERSION = 0.01;

But that is equivalent to an Extended Version of 0.10.0! Strange but true! The conversion code breaks floating point number implicitely on 3 decimal place boundaries, adding zeros on the right as needed to make up a clean multiple of 3. This is required by the fact that Perl 5.6.0 was equivalent to 5.006.

When you added a new release to CPAN like this:

use version; our $VERSION = qv("0.0.3");

the PAUSE indexer correctly noted that this was less than the current CPAN release (remember, equivalent to 0.10.0), and hence, although it was correctly added to your CPAN directory, it will not show up in the index because it isn't "newer" than the older release.

The correct fix is to submit a new release to CPAN like this:

use version; our $VERSION = qv("0.11.0");

or whatever suitable increment you see fit, such that it is a higher version than 0.10.0.

There, clear as mud???

John

perlmonks.org content © perlmonks.org and adrianh, Anonymous Monk, arc_of_descent, BrowserUk, ghenry, jdhedden, JPeacock, Perl Mouse, PodMaster, tirwhan, tye, xdg

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03