|Do you know where your variables are?|
My team has had similar issues to which you describe. No CGI or html, but aside from that broadly similar. We have tended to go with a mixture of source control (source safe in our example) and CPAN packages. We tend to build a "project" in source safe that reflects our overall setup. Module bundles that make sense to be shared between projects are checked into projects with names like "lib-foo".
Now here is something to keep in mind, the part of CPAN package that you need is only the base stuff generated by h2xs (or equivelent) and any modifications and additions YOU make. Pretty much everything that gets left behind after you do a "make realclean". You dont need to check in anything that is generated by make/make test. Thus all the mysterious files and dirs you mentioned.
When we go to set up a project the first thing we do is install any "normal" CPAN bundles using CPAN as normal. Then we "get latest version" on the relevent unpacked private bundles held in CPAN. And run the install process by hand (make/make test/make install). Any modules go into bundles like this, ready for install later.
All the rest of the project is then checked into sourcessafe "inplace". If you build your system appropriatly (and configuration system) approriately (we use a tweaked and extended Config::Inifile*) a single change in the config file can handle a total relocation of the project.
For us this generally provides a flexible way to use source code control for both installation (installs generally amount to getting certain versions out of source safe onto the target enviornment, running the make process a few times and tweaking a few things), everything is under source control, and what makes sense to share is shared.
I delibertely wrote this before I read the other replys. Reason being that we currently have been doing cleanup and work in this very area (handling installs and source control) so its been on my mind lately. Thanks for asking the question I imagine that there will be useful advice from other people.
<Elian> And I do take a kind of perverse pleasure in having an OO assembly language...