Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Errors in my (simple?) CGI Script!

by shotgunefx (Parson)
on Mar 09, 2002 at 21:09 UTC ( [id://150613]=note: print w/replies, xml ) Need Help??


in reply to Errors in my (simple?) CGI Script!

Two things right off the bat.
1. Use "==" for comparing numbers and "eq" for strings.
2. The end of HERETO docs need to be left justified.
print <<HTML;
HTML
3. Try using CGI::Carp with fatals to browsers if you don't have access to the errorlog until you get it working.

-Lee

"To be civilized is to deny one's nature."

Replies are listed 'Best First'.
Re: Re: Errors in my (simple?) CGI Script!
by cjf (Parson) on Mar 09, 2002 at 21:50 UTC
    The end of HERETO docs need to be left justified.

    This is correct, but if you want to give the appearance of indentation, you can quote the whitespace as well

    print <<' EOF'; <html> .... EOF

    Probably not good coding practice, but neat nonetheless. More information is available here (thanks to theguvnor for the original link :)

      Neat trick. The left alignment has always bugged me but I would think getting the spacing right a pain.

      -Lee

      "To be civilized is to deny one's nature."

        Actually the spacing isn't that much of an issue if you use tabs in your text editor to handle that. :)

        ..Guv

        i've recently started assigning blocks of text/html to variables like so:
        my $chunk = qq{ <b>Blah!</b><br><br> <i>Blah?</i> <u>Blah...</u> };
        then i just print it.. the reason i started doing this as opposed to using heredocs is the pretty formatting; i strip out the tabs used to indent with a regex before printing.

        as a side note, this seems to render pages MUCH faster than using heredocs. :)
Re: Re: Errors in my (simple?) CGI Script!
by munchie (Monk) on Mar 09, 2002 at 21:18 UTC
    Thank you! I knew it had to be something simple (#1).

    > munchie, the number munchin newb
    Llama: The other other white meat!
    (you had to be there :-P)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://150613]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-25 12:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found