While it is simple to include an svn keyword (E.g. "$Ig: $") in a perl comment, I want to assign it to a string variable so I can print it out or include it in a log file etc.
Various warnings etc. from the compiler suggested I declare and assign a value to it first, otherwise perl complained I was using it before it was assigned.
That was relatively trivial to fix (albeit perhaps not "properly" - see below), the remaining problem is the trailing (dangling) '$' in the string. I can't escape it using a backslash as svn doesn't find it. Ending the string with $\\" also produces a warning (uninitialized value). If I use something like the following:
our $Id = ""; our $IdEnd = ""; $script_version = "$Id: Myob2010_mpbudget.pl 32 2010-05-28 03:57:52Z a +ndrew $IdEnd";
The ending $IdEnd is not interpreted as an empty string and appears literally, which of course I could just strip off for output, but I am hoping there is a more elegant solution.
I have ended up using a "double dollar", so the svn keyword before expansion is "$Id: $$"
Can this be improved on ?
In reply to Subversion Keyword in string by nullandvoid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |