Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: use CGI or die;

by ColonelPanic (Friar)
on Jan 12, 2001 at 02:08 UTC ( #51225=note: print w/replies, xml ) Need Help??

in reply to use CGI or die;

Another huge debugging benefit of CGI is CGI::Carp
use CGI::Carp qw(fatalsToBrowser);
This is invaluable for figuring out a CGI problem. Not only do you see errors, but you can easily insert your own die(); statements to see what's going on, instead of printing your own header and HTML in several lines.

Replies are listed 'Best First'.
Re: Re: use CGI or die;
by davorg (Chancellor) on Jan 12, 2001 at 15:09 UTC

    But you don't need to be using CGI in order to make use of CGI::Carp.


    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me

Re: use CGI or die;
by epoptai (Curate) on Jan 14, 2001 at 12:38 UTC
    I always use strict, -w and fatalsToBrowser when developing, but today this caused me a huge headache in a simple script (with no syntax errors) that merely reads a file, formats the contents, and displays the html.

    It runs fine from the command line (with a few uninitialized value warnings) and could save the output with

    perl > foo.html
    but it would just whirl and give no output via CGI. I found that the code looks and behaves perfectly via CGI unless both -w and fatalsToBrowser are enabled! Shut either one off (leaving the other on) and it works fine.

    I found a certain loop in the program that seems to cause this by throwing pairs of =cut around, but the loop seems mundane and similar to the others.

    Is this odd interplay between -w and fatalsToBrowser documented?

    Update: I said i'd node the entire script to craft in a day or two but am finding it difficult to abstract a simplified example. So i'll just suggest that if your error-free cgi script mysteriously hangs, turning off either -w or fatalsToBrowser may help.

    dws - Try this for a good html ™:

      Show us the code!

      Enquiring Monks Want to Know™

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://51225]
[Corion]: ambrus: I did that in 2012 and 2013, to try it out, and I found the available time to be worth more to me than the money
[Corion]: I've started that again this month (now forever instead of a limited time), and it already destresses me a lot
[holli]: There are Anti Vaxxer weeks at IKEA.
[Corion]: Of course, it's a 20% cut in the money I receive, while the work doesn't necessarily reduce at all, but my approach is to make the work take longer instead of fitting 5 days worth of work into 4
[holli]: 50% off all children coffins.
[Corion]: holli: Ooof :)
[hippo]: Cut should beless than 20% after tax, though. :-)
[Corion]: hippo: Yeah, but at least two years ago, it still was close enough to 20% cut
[Corion]: But I have a very positive experience with a four day workweek and a three day weekend. I can't easily go back though to full money.
[Corion]: That is easy without having to pay for a house, a wife or children though. If I had any of these, or any two of these, the decision wouldn't be that easy.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2017-09-21 15:11 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (249 votes). Check out past polls.