Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Why is everybody copying version numbers all over the place in their distributions?

First, I agree that it presents problems to have more than one version number associated with a CPAN module distribution (since only one version number per distribution matters when uploading and sorting at CPAN and installing doesn't really support anything beyond "pick one version of the whole dist to install and use").

Second, I have written several module distributions that include more than one package and have never felt the need to expose version numbers except via one package per distribution. And I have never (in any module) done anything with version numbers beyond the default "let the user request 'at least version V'". Version numbers should clearly monotonically increase. So of far more importance to me than most possible aspects of version numbers is the clarity in sorting order. Most attempts to assign "meaning" to parts of version numbers usually just end up causing pain, IME.

So, in the theoretical case of me writing a module that includes multiple packages where there isn't one "main" package that always gets used and so is the only place that needs to support "require at least version V", here is how I would implement that (because it means that there is exactly one place where I track the current version number):

Makefile.PL: ... VERSION_FROM => 'lib/My/Widget/', ... lib/My/Widget/ package My::Widget::Version; require Exporter; our @EXPORT_OK = '$VERSION'; *import = \&Exporter::import; our $VERSION = 1.011_021; lib/My/Widget/ package My::Widget::Flanged; use My::Widget::Version '$VERSION'; ...

Nothing at all complicated about that. And if you don't want to pull in Exporter, then you have to have two simple lines in each "versioned" package instead of just the one.

Are there any ways in which that trivial solution is not better than any module that does work to copy-and-paste a version string into multiple files or that just checks that you did the copy-and-paste correctly?

- tye        

In reply to Re: Per-distro versioning and dependency specification (DRY) by tye
in thread Per-distro versioning and dependency specification by creamygoodness

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (8)
    As of 2020-03-31 08:06 GMT
    Find Nodes?
      Voting Booth?
      To "Disagree to disagree" means to:

      Results (180 votes). Check out past polls.