Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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"?

Replies are listed 'Best First'.
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 wind (Priest) on Mar 31, 2011 at 22:04 UTC
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://896731]
Approved by Corion
Front-paged by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2017-10-19 09:48 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (252 votes). Check out past polls.