Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: CGI script makes Internal Server-error

by DamnDirtyApe (Curate)
on Aug 29, 2004 at 22:48 UTC ( #386812=note: print w/replies, xml ) Need Help??

in reply to CGI script makes Internal Server-error

Since you've stated that you're fairly new to Perl, allow me to make some additional suggestions:

  • Always use strict, unless you know precisely why not to. This will require you to declare all of your variables with my, eg. my $cgi = new CGI;
  • Only use lib qw(.); if you actually need to load some modules from the current directory (which you're not doing in this script.)
  • Rather than the lengthy strings your using to set your page header and footer, consider using a heredoc, like so:
    my $WEBPAGE_INITIALIZE = <<'END_OF_HTML'; <html> <body bgcolor="#000000" text="#ffffff" link="#ffffff" vlink="#ffffff +" alink="#ffffff"> <font face="Arial" color="#000000"> <center> <table border="0" width="400" cellspacing="20" cellpadding="20 +"> <tr> <td> <center> <h5> END_OF_HTML my $WEBPAGE_SHUTDOWN = <<'END_OF_HTML'; </h5> </center> </td> </tr> </table> </center> </font> </body> </html> END_OF_HTML
    I find this style much more comfortable for blocks of text.
  • Do away with the error_page_exit() function, and just use die() instead; that's what use CGI::Carp qw(fatalsToBrowser) is for.

Hope you find that helpful.

Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
            --Friedrich Nietzsche

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2016-10-28 05:50 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (375 votes). Check out past polls.