in reply to CGI script makes Internal Server-error

The error is on approximately line 31 of your script (give or take a few):

print(RECORD, $val);

That should be...

print(RECORD $val);

Filehandles don't have commas after them.

How I found the problem:

It's safe to assume that if you're getting an server error despite using the CGI::Carp module, you must be getting that error prior to the printing of your headers. So that usually means there's either a permissions error or a syntax error. I cut-n-pasted your code into "mytest.pl" and typed: perl -c mytest.pl. The result was a nicely formatted (ala CGI::Carp) error message reminding me that you shouldn't put commas after filehandles in print statements.


Dave

Replies are listed 'Best First'.
Re^2: CGI script makes Internal Server-error
by reaction (Acolyte) on Aug 29, 2004 at 17:26 UTC
    Brilliant! Thank you Dave.

      You may also want to try the fatalsToBrowser option of CGI::Carp to read CGI errors in the browser when you are debugging code; if you do so you must (yes, I said MUST) eliminate it when putting your cgi in production --unless you want to show your web site internals all over the world, of course ;-)

      Update: ooooopppss!!! Here it is!? Did you add me under my nose or I have to change my glasses? :-% Anyway, the advice of removing it in production code still stands.

      Ciao!
      --bronto


      The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
      --John M. Dlugosz