I just took notice to this generated by Catalyst.pl
. It is obviously some sort of unannotated hack. What is the advantage of setting up a version string like this? I can't even figure out what they're trying to do.
our $VERSION = '0.01';
$VERSION = eval $VERSION;
From perlmodstyle: Version numbering
Version numbers are complex in Perl. Here's an excellent overview for those looking for the gory details. It might surprise you how many subtle ways there are to get things wrong...
The direct answer to your question though, is that different things expect different formats. For CPAN, you care about development versions for example, as a string. For runtime, you care about them as a number.
Consider the case of
$VERSION = "0.01_001"
.eval
converts it to the number0.01001
correctly.I may be misremembering this, but I think some automated code parsers like to see the line of code:
But you really want $VERSION to hold a float instead of a string.
You may want to read this article, I know I am going to.
Oh, dear god, now I remember why I use
style version numbers. That is just insane. I love Perl, but that is pure, refined, concentrated insanity. I won't try to summarize David Golden's article. You just have to read it and cry.
The eval converts the string
"0.001_001"
to a number, following the rules for Perl numeric literals (which allow underscores for legibility). The result is the number0.001001
.Without the eval, the string is converted to a number following the rule for converting strings, which stops at the first non-numeric character.
E.g.:
perl -e 'print "0.001_001" + 0'