« Photography Resource | Main | War on Photography »

Perforce RCS Keyword Support

Perforce supports RCS keyword expansion, as do CVS, Subversion, and others. What these expand to, and the exact keywords supported vary: CVS supports the keywords $RCSfile$ or $Source$ for filenames, while Perforce instead expands the keyword $File$.

Now, the bug that prompted this post:

#!/usr/bin/perl -w use strict; use File::Find qw(find); find( sub { print "$File::Find::name, pid=$$\n"; $File::Find::prune = 1; }, q{.} );

In Perforce, the $File::Find::name, pid=$ string looks like a $File$ expansion, and is treated as such. This causes the code to break following a commit, but only if keyword expansion is enabled on the file. The workaround ${File::Find::name}, pid=$ avoids the problem by segregating File: from the dollar sign.

I do not consider turning off keyword expansion an acceptable workaround. Knowing where the file came from, who edited it, and how long ago greatly benefits debugging and fixing problems.

Technorati Tags: