in reply to Interactive debug of CGI.pm script with requests from a browser

There are, as they said, lots of “local web server” programs available.   For example, I am right now working on a big, hairy monster of a program that I have tamed enough to run, no longer under mod_perl, but Plack.   To test it, I can now simply run the plackup command, which is provided by Plack, and now I can access the web site at http://localhost:5000.

So, now, your CGI program is, indeed, running in a bona fide CGI-environment ... it’s just doing it within your own terminal session.   The STDERR output and so on is right there in the appropriate terminal-window.   Tools like WWW::Mechanize can communicate with this local port-number just as easily as with any other.

The only thing that doesn’t work is SSL, due to port-number issues and so forth.   But you can program your application not to require SSL when it’s running in localhost, even though it might demand to do so in production.   (plackup sets environment variables as a positive indicator of this, for example.)