Home > Perl > Introduction > Tracking Changes to your Perl Scripts
Tracking Changes to your Perl Scripts
Written by Philip L Yuson   
Who is this for
This is for developers who are looking for ways to track changes to their programs


What you need to know
Unix, Linux or Windows commands

Introduction
You needed to revise your program. You got the source and began changing a lot of codes. You ran it and it did not work. Did more changes and tested it, and it worked but what used to work did not! How are you to check what revisions you did? Unless you document properly all your changes, you have to eyeball your current program with the original one. (This is assuming that you did backup your source).

Concurrent Versions System (CVS)
Fortunately, there is a version control tool that is used in the Unix/Linux world. You can also use this in Windows. CVS is basically a change control system. It allows you to save your original source, make changes to a copy of your source, document the changes and then implement these changes. It also allows you to share a copy of a source among the team. If a person changes one part of the code and you change another part of the code, it can consolidate these two changes or it will report of any conflicts between the two changes.

Where Can I get CVS
If you are using Unix or Linux, you will need to install CVS and RCS on your system. You can get the Linux/Unix version from www.cvshome.org. If you are using RedHat or Mandrake, you can use the RPM file to install it. If you are using Windows, you can have a cvs for Windows at www.cvsnt.org. The installation process depends on how you got your source so will not be covered in this article.

Setting up your session for CVS

You will need to pre-define several variables before you can begin using CVS. Before you start, you need to define the CVSROOT variable. This identifies where your CVS repository is. If your installation has cvs working, you can proceed to use it. If not, you have to initialize the repository. You do this by going to your CVSROOT, then issue the init parameter:

cvs init



This initializes your repository.

Registering your source code
Assuming that you are working on a project that has several source codes, you will need to register these to the repository. You do this by going to the directory where your source codes are and import these to the repository.

cvs import projectname vendorTag ReleaseTag



You have to specify the vendorTag and ReleaseTag even you will not be using them. When you issue this command, cvs will start a text editor and you can enter your comments for this import process.

Editing your source
You can still edit your existing source code but cvswill not allow you to check it into the repository. This is a safety mechanism to prevent you from changing your codes without control. The only way to edit your code is to check out your code. You have to go to the directory where you want to save your checked-out code and type in this command:

cvs checkout projectname/programname



If you omit the programname, cvs checks out the entire directory. Once you have checked out your programs, you can edit them.

Checking in your code

After editing your code, you have to test it and make sure that it works. This is very basic but one will be surprised that there's a lot of people so confident of their work that they do not test them. Once you're satisfied that it works, you can check in the code(s) back to the repository. You do this through this command:

cvs commit projectname/programname



During the check in process, cvs will fire off your editor and have you put in comments for this round of revision. Make your comments understandable. Terminate the editor and the program(s) will be checked into the repository.

 
Copyright: © 2017 Philip Yuson