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

There are a ton of pseudo-web servers on CPAN. Have you checked? There are ones like HTTP::Server::Simple, Net::Server::HTTP, and even IO::All can handle it. From these, you could simply load your code and run it. My suggestion is that you should have all of your CGI code in a module, your real .cgi script would simply be use My::CGIApp; my $app = My::CGIApp->new(); $app->run(). And your fake server would do the same: the request handler would create a new object of your app type, and run it (the "use" bit would still be needed, too, of course). This would then load your code at first (with the use), you could run it in the debugger, and break wherever (since your code is already loaded). Point your browser at localhost:$port, and you're golden.

Well, of course you'll have to handle the static content, too, but that's not too hard: check if the relative file exists, serve it. But I usually use this method just to focus on one thing at a time, not the whole site ;-)

  • Comment on Re: Interactive debug of CGI.pm script with requests from a browser
  • Download Code