Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

concerning our $VERSION

by John M. Dlugosz (Monsignor)
on Mar 31, 2011 at 21:20 UTC ( #896731=perlquestion: print w/ replies, xml ) Need Help??
John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:

First, I see this idiom being used:
our $VERSION = '0.01'; $VERSION = eval $VERSION;
Why does it set it and then eval it?

Second, I'd like to put the $VERSION in its own file. This is to make it easy to match up versions of the code (using git) with versions of non-code assets like large image files, which are kept out of git and saved in a simple manner.

If I include the file in a normal way, it has its own scope. Is there a simple way to just include it "in place"?

Comment on concerning our $VERSION
Download Code
Re: concerning our $VERSION
by wind (Priest) on Mar 31, 2011 at 22:04 UTC
Re: concerning our $VERSION
by bingos (Vicar) on Mar 31, 2011 at 22:04 UTC

    The rather long version (haha) of the reasoning behind evaling the $VERSION is explained here

      That gets it wrong; the proper incantation suitable for all modules is:
      our $VERSION = '1.001_001'; our $XS_VERSION = $VERSION; # only needed if you have XS code $VERSION = eval $VERSION;
      as described in perlmodstyle
      --
      A math joke: r = | |csc(θ)|+|sec(θ)|-||csc(θ)|-|sec(θ)|| |
      Online Fortune Cookie Search
Re: concerning our $VERSION
by sundialsvc4 (Abbot) on Apr 01, 2011 at 00:13 UTC

    ... and my “take-away” from the two articles previously cited is that the notion of “putting the version in its own file” should be answered with a resounding, Nyet!

    This string is intended for programmatic consumption, and so it ought not do “differently.”

    This reply should not be taken as an authoritative statement.   I could well be wrong.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://896731]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2015-07-04 02:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls