It all depends if the script uses GET or POST methods...
What I normally do is either use the CGI.pm library for the POST style scripts...
If it is GET style, I will write a subroutine call around the beginning of the file that dumps the environment to a file... I then convert that file to a bash script and tweak the variables for exactly how I want them, then the last line would call the script via 'perl -d script.pl'...
Debugging CGI scripts is an artform that requires time and patience to acquire... There is no easy way to duplicate the same environment that Apache runs the script in, versus your manual debugging invocation - but you can get mighty close...
I had the unfortunate task of learning all about CGI debugging the **hard** way, mostly by trial and error... I still have nightmares of a particularly heavy duty message forum that I worked on for a long time... (Deb, you listening???) :p
--
Terra
sysAdmin
FutureQuest