in reply to Package/module organisation question
Let me contribute just a few more thoughts about your AcmeAPI.pm. It is not quite clear from your description whether this is indeed an API, say to an external .so or .dll library, or just “a stinkin’ hunk-o’ legacy code.” (Don’t be alarmed... we all have one.) Unless you want a big fat chunk of code to monolithically be inserted into, not only your CGI programs but everything else as well, then you’re going to have to develop a strategy for splitting it up ... CGI or no.
Most of the time, when tasked to do this, I first of all decided to leave the original file-name alone, because I could not know how many other routines might refer to it. But I transformed it into a “stub” module that used the component chunks into which i broke it. This facilitated source-code compatibility.
I then broke out the source-code into reasonable subdivisions, building a module structure. Initially, I had each one of these use the original name (now a stub), so that the end-result was, at least at first, that “everything got sucked in at once.” But then, later on down the road, I could start replacing those with more specific uses.
It is extremely important to use source-code version control! (I use git since it requires no server, and because it integrates directly into the Eclipse editor that I also use.) You need to first check-in the source code exactly as it is, then make a dummy branch (which will not change) representing it, and then another separate branch into which you will begin to check-in your various revisions as you systematically make them. Check-in every significant change as soon as you make it, and keep detailed notes right there in the log. In this way, every change that you (or anyone else on your team) makes, is both documented (both in substance and in intention), and reversible at will. (Yep, nothing beats a good wayback machine ...)
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Package/module organisation question
by Ralesk (Pilgrim) on Jun 13, 2012 at 19:53 UTC |