Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: module version numbers

by syphilis (Chancellor)
on Jul 15, 2009 at 12:47 UTC ( #780291=note: print w/replies, xml ) Need Help??

in reply to module version numbers

About the only thing that seems reasonably certain is that I shouldn't use v-strings

Why is that ?
I think some of my modules *do* use v-strings. At least I find I have (in some of my modules) things like:
$My::Module::VERSION = '1.23';
Others of my modules don't stringify the version:
$My::Other::Module::VERSION = 2.45;
I've always simply specified my versions as x.xx and have had no problems with that (irrespective of whether the x.xx is stringified or not). I guess this might impose some limitations on my options but, as far as I'm aware, it doesn't impose any limitations that bother me.

I now begin to wonder if I'm doing something that *should* concern me :-)


Replies are listed 'Best First'.
Re^2: module version numbers
by ig (Vicar) on Jul 15, 2009 at 13:27 UTC
    Why is that ?

    The version documentation has a section on v-strings that begins:

    Beginning with Perl 5.6.0, an alternate method to code arbitrary strings of bytes was introduced, called v-strings. They were intended to be an easy way to enter, for example, Unicode strings (which contain two bytes per character). Some programs have used them to encode printer control characters (e.g. CRLF). They were also intended to be used for $VERSION, but their use as such has been problematic from the start.

    And goes on to more discouraging things, including:

    the use of bare v-strings to initialize version objects is strongly discouraged in all circumstances (especially the leading 'v' style), since the meaning will change depending on which Perl you are running.

    Then gives some guidance in case you insist on using bare v-strings with Perl > 5.6.0.

    Re-reading this now, maybe it is only bare v-strings that are being discouraged. On the other hand, maybe they are all problematic but only the bare ones are being strongly discouraged.

    Otherwise, Why will v-strings be deprecated and v-strings deprecated; what to use instead? suggest v-strings are deprecated. Have they since been redeemed?

    v-strings must die! also suggests v-strings are not good. But this is from 2003, so the situation and intent could have changed since then.

    Maybe I shouldn't have been so quick to scratch v-strings off my list of possibilities?

Re^2: module version numbers
by jeanluca (Deacon) on Jul 15, 2009 at 13:26 UTC
Re^2: module version numbers
by ig (Vicar) on Jul 15, 2009 at 13:40 UTC

    I don't think versions like:

    $My::Module::VERSION = '1.23';

    are the deprecated v-strings, despite being strings with version numbers in them. If you put a 'v' at the front, then it might be a v-string and I am more certain that if it was unquoted with a v in front that it would be a bare v-string. So, if I understand correctly, many people consider the following to be bad:

    $My::Module::VERSION = v1.23;

    On the other hand, see Re: Seeking thoughts on version numbers in modules - maybe v-strings (the magic variety as of 5.8.1) are OK after all. Still, my conclusion is that with so much contention, it is probably safer to use some other form (like what you are using, which is consistent with most of the core modules), at least until the dust settles on v-strings, one way or the other.

      Excellent ... nothing for me to worry about :-)
      Thanks for clarifying.

Re^2: module version numbers
by ikegami (Pope) on Jul 16, 2009 at 03:05 UTC

    I think some of my modules *do* use v-strings. At least I find I have (in some of my modules) things like:

    Those aren't v-strings. v-strings start with a literal "v" like v1.2 and v1.2.3. Use version's qv instead of using v-strings.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://780291]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2018-06-21 14:26 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (118 votes). Check out past polls.