Re: version.pm and underscores

[email protected] (Eric Wilhelm)
Newsgroups perl.module.build
Message-ID <[email protected]>
# from John Peacock
# on Wednesday 23 September 2009 07:23:

>When an
>underbar/underscore is encountered, that is used as an additional
> split character and the is_alpha flag set, so that the last "digit"
> of the version is the "alpha release".

Why is the underscore treated as a split character?  This is actually 
counter to how v-strings work.

  $ perl -E 'say join(".", map({ord($_)} split(//, v2.3.4_5)))'
  2.3.45

Although this also means that v-strings don't preserve the underscore.  
This means the behavior of 5.8.8 changes depending on whether 
version.pm was loaded (ever).

  $ perl -e 'BEGIN {
     package foo; our $VERSION = v2.3.4_5; $INC{"foo.pm"} = 1};
     use version; use foo v2.3.5;'
  foo version v2.3.5 required--this is only version v2.3.4_5 ...

  $ perl -e 'BEGIN {
     package foo; our $VERSION = v2.3.4_5; $INC{"foo.pm"} = 1};
     use foo v2.3.5;'
  # no error (45 > 5)

So, the only dependable way to move past an alpha release is to bump the 
next digit to the left of the dot before the underscore.

But I'm looking forward to a world where we don't need to juggle the 
numeric/string duality to mark alpha status.

--Eric
-- 
"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.