Rcs::Parser - Parse and analyze RCS files.
A basic RCS parser. This file does not rely upon any external utilities to parse RCS files. Currently it functions with RCS files generated by GNU CVS and as documented by the rcsfile(5) man page.
Retrieve the most recent file from an archive:
my $rcs = new Rcs::Parser; my $ret = $rcs->load($filename); my $current = $rcs->recent_version;
To retrieve a specific version:
my $rcs = new Rcs::Parser; my $ret = $rcs->load($filename); my $specific_version = $rcs->get('1.2');
my $author = $rcs->author($version);
The author method returns the author name of the given version. If no version is given it returns the author of the current loaded version.
my $date = $rcs->date($version);
The date method returns the revision date of the given version. If no version is given it returns the date of the current version.
my $ret = $rcs->get($version);
This method causes the given version to be retrieved from the archive
my $ret = $rcs->load($filename);
The load command reads in and parses the given filename. If the file does not exist or is unreadable by the script, undef is returned. Otherwise, 1 is returned upon success.
my $ret = $rcs->load_scalar($data);
The load command reads in and parses the provided RCS file in scalar form. 1 is returned upon success.
my $ret = $rcs->notate()
This method builds and assembled statistical information for verions.
my @versions = $rcs->all_versions();
This method returns an array or arrayref of all versions stored in the RCS file.
my $ver = $rcs->previous_version();
This method returns the version previous to the currently instanced version.
my $ver = $rcs->recent_version();
This method returns the most current revision of the file.
my $ver = $rcs->version();
This method returns the currently instanced version.
This code is beta. It has yet to fully understand binary formats stored in RCS and will treat them as text. Consquently, you'll see warnings. That being said, there shouldn't be any large scale bugs that will cause segfaulting or crashing. Only warnings.
The RCS file format:
There is an astounding lack of good documentation of the RCS format. About the only thing that can be found is the rcsfile(5) man page. The layout is mostly reverse engineered in this module. I have yet to have the time, or the skill and patience to disassemble the RCS portions of the code for GNU CVS.
Q: Why 'Rcs' and not 'RCS' A: Because the any directory named 'RCS' is usually ignored by most versioning software and some developer tools.
Rcs::Parser v0.02 2004/04/02 (c) 2001-2008, Phillip Pollard <email@example.com> Released under the Perl Artistic License