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 ;-)


In reply to Re: Interactive debug of CGI.pm script with requests from a browser by Tanktalus
in thread Interactive debug of CGI.pm script with requests from a browser by chrestomanci

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.