I mentioned I am refactoring some code for a client. My first step was reformatting (perltidy and some by-hand stuff), and fixing up some minor code mistakes and consolidation along the way. I'll tell ya, formatting helps wonders. Spending the time to do proper indenting, make some things more consistent, and more visually pleasing can make speghetti look much more like ziti.
Now I can start breaking out some redundant code and making it modular. The guy(s) who originally wrote this were, er.. not the greatest with code design. Sort of half Matt Wright-esque and half "Hey, noone else will ever work on this". Of course, now I am maintaining it so I feel the need to better it for my own sanity and time.
There are thousands of lines of code in about a dozen scripts. No warnings, no stricture, not even using CGI.pm (except for sections I added) or ANY (that's right NONE) modules from CPAN (again, except for my sections) aside from DBI. Thank god they didn't reinvent DBI along with everything else!!
So, now I need to plan how to keep making the code better without completely rewriting it. As I went through the code I noticed some obvious things to consolidate... so I guess I'll start there and see where it goes. At the very least, I can now visually follow the code!