Greetings wise brothers

I am a fan of the perl debugger, the interactive command line one. Some people have fingers trained for Vim shortcuts, mine are trained to type x 3 $varable or b <line> $foo =~ m/bar/. My prefered method of writing perl is write a skeleton that passes perl -c and then debug it by testing out constructs in the debugger, and pasting what works into my editor.

With that in mind how should I debug a cgi script that uses CGI.pm while viewing and interacting with it using a normal web browser?

In the past I have worked on a Catalyst application, where I could run perl -d script/myapp_server.pl set breakpoints on areas of interest, and then point my browser at http://localhost:3000. When my code hit a breakpoint I could debug normaly, but at the same time I can see results as the end user does in a web browser.

I know that with CGI, you can run the script on the command line and debug it that way. The problem with that approach is that it is hard if you want to pass in a lot of form parameters, and the output you get is raw HTML.

I also know that you can do printf style debugging by running the script on a webserver, and causing it to embed lots of trace output into the page it generates.

I have also found that the EPIC IDE (a plugin for Eclipse) will let you debug cgi scripts using a built in web server. This is what I want, but without the GUI. The EPIC debugger is slow, unstable, and not as powerfull as the command line.

In short is there a perl web server out there that will run cgi scripts in the same process as the server, so that I can just run perl webServer.pl /path/to/web-root and have it execute those cgi scripts using the same perl process, while also serving up static content so that I can browse the site I am working on with a normal browser.

Thank you.


In reply to 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.