Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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
[marto]: oddly the last time I was there I saw a zeppelin in flight for the first time
[Corion]: ambrus: I don't know how far the budget estimate has been overrun yet
[Corion]: marto: Heh ;) No, you were likely at Tegel or Schönefeld, the new one ("BER") will be somewhat outside of Berlin ;)
[marto]: Corion Schoenfeld, but my friend has been telling me about this new airport for about 7-8 years now :P
[marto]: I doubt it even exists as a building site :P
[ambrus]: Corion: does building airports "somewhat outside of" a city ever work? cities always grow around the airport quickly, because it's practical to be close to it, and after that, people start to complain that the airplanes land so close to their house and sh
[ambrus]: ould keep down the noise

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2017-02-23 11:58 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (346 votes). Check out past polls.