cpatrick has asked for the wisdom of the Perl Monks concerning the following question:

Hello all-

I was wondering if anyone has any experience integrating RCS with Perl CGI. I have a GUI interface currently where a user can upload a file. I want the code to not only place the file into an appropriate directory, but place the file into RCS control as well. If it is just an updated version of a file, I want to simply check in the new version of that file.

If anyone has experience doing this, and could possibly point me in the correct direction, I would greatly appreciate it.

Take care
Chris

Replies are listed 'Best First'.
Re: Integrating RCS with Perl CGI
by DrWhy (Chaplain) on May 09, 2005 at 20:34 UTC
    There is an Rcs wrapper module in CPAN called Rcs which worked well for a group I was working with. Part of our task involved controlling certain rcs activities through a Web browser. There were at the time a couple of bugs and misfeatures that we worked around by subclassing Rcs and replacing or wrapping some of it's methods. I notice that the CPAN module has been upgraded since then, so some of those problems may have been addressed. One issue you'll need to be concerned with if you are coming in through the Web is user identity. When coming in though a Web server all rcs checkins will be recorded as being done by your web server user, not the user that is on the other end doing the real work. The same is true for any locks that are obtained and any access restrictions based on username. We overcame some of the problems -- engough that the system worked for us -- with some hacky slight of hand with user session information (our users had to authenticate in order to do rcs work) that the server collects. IIRC, it involved creating a special branch off of the initial 1.1 revision that was tagged with a specially formatted string that included the real users name. As I said, it was a hack.

    There is another more complex Rcs interface in CPAN, VCS::Rcs. I have never used that one, but it might be worth a look, too.

    --DrWhy

    "If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."

Re: Integrating RCS with Perl CGI
by dynamo (Chaplain) on May 09, 2005 at 20:33 UTC
Re: Integrating RCS with Perl CGI
by mda2 (Hermit) on May 09, 2005 at 20:37 UTC
    I had experiences around 3 or 4 years ago, using the RCS module, to admin cvs files (same format) and it's great.

    I see references on Perl for System Administration book, only "five minutes", but very good five minutes!

    See a perlmonk review.

    --
    Marco Antonio
    Rio-PM

Re: Integrating RCS with Perl CGI
by jfroebe (Parson) on May 09, 2005 at 20:52 UTC

    Hi Chris,

    I've been using SCCS, which is very similar to RCS (see Applying RCS and SCCS from O'Reilly), with CGI.pm. I've ended up writing a simple wrapper for managing the SCCS archive from CGI. The main issues you will run into is permissions on the RCS/SCCS archive, concurrent access to the file(s) and security (running it under Taint mode for example).

    My recommendation is to write a module with a simple wrapper with ONLY the functionality that you need and include it in your cgi script (use my_module). Perhaps something like:

    • rcs_checkin()
    • rcs_checkout_rw()
    • rcs_checkout_ro()
    • rcs_checkout_abort()
    • rcs_checked_out_by_user()

    Why put these in a module? It will be easier to test the functions in a regular script to verify that there aren't any errors or logic issues with the rcs subroutines. Debugging in a cgi environment is far slower than in a regular script environment IMHO

    That should be enough to get you started in what you need.

    Jason L. Froebe

    Team Sybase member

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

Re: Integrating RCS with Perl CGI
by Velaki (Chaplain) on May 09, 2005 at 20:08 UTC

    Not exactly perl, but the closest I've come to with this is using WebDAV with Subversion.

    Just a thought,
    -v.
    "Perl. There is no substitute."
Re: Integrating RCS with Perl CGI
by Whitehawke (Pilgrim) on May 10, 2005 at 02:46 UTC
    Hi Chris,

    Others have given you the relevant pointers but I just thought I'd drop this in:

    Before you put a lot of effort into making this work, seriously consider upgrading from RCS to Subversion. It is very powerful, and has a built-in method to do pretty much exactly what you're looking for.