in reply to Re^3: help with start_table of CGI.pm
in thread help with start_table of CGI.pm

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^5: help with start_table of CGI.pm
by davorg (Chancellor) on Feb 02, 2007 at 09:34 UTC
    My program compiled cleanly (when I used the -c option) but when I ran it from a command line, I got a TON of warning messages (I assume they were warnings, because it didn't stop the program from running) that were essentially due to my environment didn't have a number of environmental variables set that are normally set in a CGI environment.

    Yes. A CGI environment has a lot of variables set that aren't usually present in a shell environment. Nothing to stop you setting them though.

    So that is why I removed the 'using strict', to get away from those warning messages and see messages that were really run time failures, which I've seen happen. Errors that the compiler didn't catch, but they were caught at runtime.

    Yes. Programs have compile-time errors and runtime errors. You need to use different tools to catch both of them. But you need to catch and eliminate both kinds of error.

    So how do you propse to get around this problem?

    Either learn to ignore the errors that are caused by the fact that you're not running in a CGI environment or set up your shell environment so that it looks like a CGI environment.

Re^5: help with start_table of CGI.pm
by neilwatson (Priest) on Feb 01, 2007 at 21:41 UTC
    The errors in your script will be printed in the web server log. Also the CGI::Carp module allows you to send errors to the browser.

    Neil Watson
    watson-wilson.ca

Re^5: help with start_table of CGI.pm
by GrandFather (Saint) on Feb 01, 2007 at 21:50 UTC

    That sounds like a warnings issue - probably using an undefined value - that is not affected by use strict. If that is the case then you were being told stuff you needed to know: required environment variables hadn't been set! The fix for that is to set the variables.

    If the warnings were something else, can you reproduce the problem and show us the warning/error and the lines of code involved?


    DWIM is Perl's answer to Gödel