in reply to Conditional is stopping script

this condition statement is causing the full script to fail.
What do you mean? Are you getting an error message? Is a message showing in your logs? Is the script dying silently? If you're getting any kind of error message, please include it. Otherwise it's next to impossible to figure out any kind of diagnosis.

Replies are listed 'Best First'.
Re: Re: Conditional is stopping script
by heretic (Initiate) on Apr 06, 2004 at 03:53 UTC

    Hi!

    Sorry if I'm being a pain. I'm teaching myself perl so I'm not sure what you're needing.

    What's happening when I run the script is that the page does not display in the browser. The browser simply sits and displays nothing but a blank screen when the script is called directly from the location box of the browser.

    This is the message that I'm getting in my log relating to the file. I'm not sure where I would find the error message that you're speaking of. I'm using the sambar server on my computer and serving the documents out of it.

    127.0.0.1 - - [05/Apr/2004:23:24:42 -0400] "GET /cgi-bin/homeblood.pl? +datedata=04%2F01%2F04&eaten=no&timedata=8%3A30&shift=am&readdata=110 +HTTP/1.1" 200 0 125 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en- +US; rv:1.5) Gecko/20031007"

    I'm afraid that I don't know what it means.

    The code for the full script I'm creating is:

      Some comments:
      • There is an excellent perl module CGI that does all the hard work in parsing requests like yours and creating webpages. It's included in a typical perl distribution. For a tutorial check out this excellent piece of literature: Ovid's CGI Tutorial
      • Using hashes consequently. In your code you mix statements like this:
        $morneaten = $formdata{'$eaten'};
        with:
        $nooneaten = $formdata{'eaten'};
        The difference is that in the first line you are looking up the hash value for the literal value $eaten (including the dollar sign, because everything inside single quotes is taken literally), while in the second line you are looking up the value for eaten (without the dollar sign).
        When you would be using the CGI-module, most probably your code would look like:
        use CGI; my $query = CGI->new(); .... $nooneaten = $query->param('eaten');
      • webserver logs:
        127.0.0.1 - - [05/Apr/2004:23:24:42 -0400] "GET /cgi-bin/homeblood.pl? +datedata=04%2F01%2F04&eaten=no&timedata=8%3A30&shift=am&readdata=110 HTTP/1.1" 200 0 125 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-U +S; rv:1.5) Gecko/20031007"
        This means that your webserver has received a request to the script homeblood.pl (GET /cgi-bin/homeblood.pl), the part after the ? are your parameters, separated by &-signs (for instance 'eaten=no'). If your webserver has an error log that would be a good place to look for errors. Another way to check your script is to run in from a cmd-prompt, and see what output (and possibly errors) it will give you.
      hope this helps