Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://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/Version.pm', ... lib/My/Widget/Version.pm: package My::Widget::Version; require Exporter; our @EXPORT_OK = '$VERSION'; *import = \&Exporter::import; our $VERSION = 1.011_021; lib/My/Widget/Flanged.pm: 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

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-23 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found