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

concerning our $VERSION

by John M. Dlugosz (Monsignor)
on Mar 31, 2011 at 21:20 UTC ( [id://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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-25 11:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found