in reply to Re: error management...
in thread Newbie error management question

He's not using CGI (which you really should do for anything of any size... check use CGI or die; for why), he's printing the header manually, and it looks like it's right.

Given that, it's likely an error message of some kind printing to STDERR before you print the header, shambright--is there anything else in the error log entries that might indicate that? Usually when I pull that stunt, it comes out with something like "failed to emit valid header (got 'Use of uninitialized value at foo.pl line 34')" .



If God had meant us to fly, he would *never* have give us the railroads.
    --Michael Flanders

Replies are listed 'Best First'.
Re: Re: Re: error management...
by Sifmole (Chaplain) on May 15, 2001 at 22:53 UTC
    So much for my reading comprehension, I missed the
    print "Content-type: text/html\n\n";
    But he is using CGI, check at the start of the code.
    #!/usr/bin/perl -w # NEEDED Variables $basedir = "/home/**/**"; $linkscgi = "http://www.foo.cgi"; # use form to get the data use CGI qw(:standard); $query = new CGI;
    Now I am going to have to look a little closer
      Ah-ha!

      You are using "perl -w", which is good; But you are failing to listen to the warnings I believe. If you run it, you will see that you get a warning

      Name "main::basedir" used only once: possible typo at ./index.pl line +5.
      A simple perl -c index.pl would have turned up this warning as well.

      updated Removed incorrect information regarding warnings and STDOUT

        Warnings are printed to STDERR, and so they don't get outputted to the browser (with most UNIX / Webserver combos)...

        Thanks to ChemBoy for noting that IRIX + Netscape Server does send warnings to the browser)

        ar0n ]

Re: Re: Re: error management...
by shambright (Beadle) on May 17, 2001 at 02:40 UTC
    All right, I think I am making progess.... I ran the script from the command line, (using the suggestion from Sifmole, thank you)

    To avoid "use of unintialized value" errors, I had to add some lines to check for NULL occurances of the form variables (and $TRACKER - which gave a NULL value from the command line{???}):

    $TRACKER = $ENV{'HTTP_REFERER'}; if (!($TRACKER)) { $TRACKER = $ENV{'REMOTE_ADDR'};} #added if (!($TRACKER)) { $TRACKER = ""; } # why would these ENV variables BOTH be blank ??? $client_email = $query->param('email'); #added if (!($client_email)) { $client_email=""; } chomp($client_email); #added to other query vars...

    This seems somewhat redundant, BUT... those first few variables were happening BEFORE I sent the headers.

    is there a better way to assure that the form values that are needed are not NULL before proceeding?