Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Seeking thoughts on version numbers in modules

by JPeacock (Novice)
on Jan 26, 2005 at 20:07 UTC ( #425359=note: print w/ replies, xml ) Need Help??


in reply to Seeking thoughts on version numbers in modules

Being sort of the resident $VERSION guru (and, no, this isn't a good thing), I'll take a crack at these.

Here are some answers (all IMNSHO unless otherwise noted):

  1. v-strings are not deprecated, as such. See the discussion below for details.
  2. If you want to use 'our' make sure that you also 'require 5.6.0;' at the same time. 'use vars' always works, but if you have no need to support earlier Perl's, there is no reason not to use 'our'
  3. One thing to realize is that because version.pm has to follow the Perl versioning rules (as set out in the 5.6.0 release), subversions are 3 decimal places and not 2, so 1.23_04 is displayed by version.pm as 1.230.400 (when stringified).
  4. I'm using Subversion myself and I don't have a good answer yet; I have been working on a custom keywords patch which would permit setting a property which would populate the $VERSION string. I have pseudocode for a script called 'release' which would increment the property, build and test the distro, check it into the repository and create a release tag. No, it's not done yet. ;)
  5. If the modules will never live an independent life, share the $VERSION with the master module; if not, $VERSION scalars are cheap and it would be easy to create a script which will check to see if a given PM file has changed and increment the $VERSION. Yes, I have some ideas for version::Math...
  6. The code that constitutes version.pm exists in bleadperl and is very likely to remain there for 5.10.0. If you want to make sure that your module works, you can 'use version;' which will be a no-op in 5.10.0 and will load the compatibility layer back to 5.005_03. Think of version.pm as a pragma (which it is) that changes the version handling to correspond to the future of Perl.

    The v-string dilemma

    There are sadly too many evil^Wuseful ways that people have used them to permit their wholesale destruction. However, the use of v-strings as $VERSION is not recommended except in Perl 5.8.1 or better. The short story is that until the magic v-strings were introduced with 5.8.1, it is impossible to tell whether a given scalar was originally created via a v-string (i.e. it is a lossy transform in the tokenizing phase).

    However, Larry has indicated that the leading 'v' numbers will be used in Perl6 to be version objects (which may or may not be implemented in the same way as version.pm and 5.10.0 does). So I think that by the time Perl6 is out, the use of code like this will be eliminated:

    my $crlf = v13.10;

    Yes, that is actual code in the wild!

    Other version magic

    Someone asked about a way to be very specific about what versions of a module could be used, so I created version::Limit to specify exactly which releases were compatible. If you value a strong API, it may be useful to you. NOTE: that this module is most useful with Perl 5.8.1 or better, so you can use bare v-strings and have it mean what you think it means.

    If you want to use arbitrary version strings, like 1.2b2, and still have them sort like you would like them to, you might find version::AlphaBeta useful; then again, you might be insane. ;)

    I hope this helps more than it confuses things.

    John Peacock


Comment on Re: Seeking thoughts on version numbers in modules
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://425359]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2014-07-31 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (244 votes), past polls