VCS::Rcs::Deltatext - Perl extension for RCS like Deltatext parsing
use VCS::Rcs::Deltatext; my $dt = new VCS::Rcs::Deltatext(); # Parse RCS file and find the last revision. # Put 'Last Revision' in $dt->lastrev($ref_text, $rev); # Parse RCS file and find the following revisions # Aply the deltatext $dt->deltarev($ref_deltatext, $rev); # add other details $dt->date($rev. $date); $dt->author($rev. $author); $dt->anything($rev. $anything); ... ... # more 'deltarev's and details @all_revisions = $dt->revs(); print "Revisions Text : ", $dt->rev('1.1'), "\n"; print "Revisions Date : ", $dt->date('1,1'), "\n"; print "Revisions Athor : ", $dt->author('1,1'), "\n"; print "Revisions Anything: ", $dt->anything('1,1'), "\n";
VCS::Rcs::Deltatext, simply applies 'diff -n' style patches. This format is used in RCS files to keep the file history. Because there is no other use for today (as far as I know) this class is put under VCS::Rcs::. Unless you have a verygood reason not to use patch(1)
new
$o = new VCS::Rcs::Deltatext;
Create a new instance of VCS::Rcs::Deltatext.
lastrev
$o->lastrev($ref_text, $rev);
Put the latest revision into the object.
deltarev
$o->deltarev($ref_deltatext, $rev);
Patch the latest revision stored in the object. $ref_deltatext is a referanse to a scalar containing the text with the diff -n style format. It is constracted from two simple command. d delete and a add. Here is a sample:
diff -n
d
a
d2 1 a2 1 Text to be added d5 4 a8 2 More text to add And more.
This kind of format is used in RCS files. And also if you use diff(1) command with the option -n you should get the same sort of format.
-n
rev
$o->rev($rev);
Get a specific revision.
date
$o->date($rev, $date); $o->date($rev);
Assigne or get a date for a revision
author
$o->author($rev, $author_name); $o->author($rev);
Assigne or get a author name for a revision
anything
$o->anything($rev, $date); $o->anything($rev);
Assigne or get any kind of other information you want to keep for a revision. This is an AUTOLOAD future.
It keeps all the revisions in the object, and uses split on ant text you supply so it can be a memory monster if you are working with large number of revisions or text.
There will be more documentation soon.
Ziya Suzen, ziya@ripe.net
rcsfile(5), diff(1), patch(1), Rcs(3), perl(1).
To install VCS::Rcs::Parser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm VCS::Rcs::Parser
CPAN shell
perl -MCPAN -e shell install VCS::Rcs::Parser
For more information on module installation, please visit the detailed CPAN module installation guide.