Posted on 2008-08-15 21:50:22-07 by gr001032
RCS keyword conundrum

I'm trying to figure out a way to include an RCS Revision keyword that sets a $VERSION value without getting any errors or warnings from perlcritic.

Currently, I use a technique to set $VERSION to the value of Revision that I found in the book Perl Medic by Peter J. Scott. For example, I have:

our $VERSION = (qw$Revision: 1.79 $)[-1];

This works fine, but Miscellanea::RequireRcsKeywords gives me an error because it can't find the Revision keyword. I assume it's just looking in strings or comments. In the documentation for Miscellanea::RequireRcsKeywords, they give an example to do the above using the construction:

our ($VERSION) = '$Revision: 2609 $' =~ m{ \$Revision: \s+ (\S+) }x;

That works fine for me but now ValuesAndExpressions::ProhibitInterpolationOfLiterals gives me a warning that I have string that may require interpolation.

I'd like to try to find a way to do this that makes perlcritic happy. I suppose I could the first method and also stick a Revision keyword in a comment, but I would like to know if there's a way to do it more elegantly.

Direct Responses: 8625 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.