What you probably _really_ want (esp for the file upload stuff) is CGI::Capture, which is the anally-retentively-accurate record and playback module for CGI calls.
Add the CGI::Capture line to the script pointing at a file, and after you do the first call to the CGI, it will replay the same request over and over, and if you run the CGI script from the console it will do a whole bunch of checks to make sure you are doing the debugging as accurately as possible.
And because it works at the filehandle level, it isn't even dependant on CGI. You should be able to use it with anything.
Re^2: Becoming familiar with a too-big codebase?