Gorby has asked for the wisdom of the Perl Monks concerning the following question:

Hello Wise Monks,

I've just upgraded my installation of perl to v5.8.7 in Windows and suddenly my print header; statements don't work. I noticed that it stops working whenever there is a file that is opened using the open() statement before the print header; statement. Somehow the headers aren't successfully sent to the browser when I access the .cgi program from an external machine.

What could be going wrong?

Thanks in advance.

Gorby

Replies are listed 'Best First'.
Re: Print Header in Perl v5.8.7
by aukjan (Friar) on Aug 19, 2005 at 11:26 UTC
    Show us some of the code that's failing. Are you using CGI.pm? Is it installed correctly in the new installation? Please a bit more detail...

    Go Fish!

      Here's the code:

      #!/usr/bin/perl -w use CGI qw(:all); use strict; open(TESTFILE, ">thetestfile") || die "Cannot open $!"; close(TESTFILE); print header; print "DONE";
      The result is the following on the browser:

      CGI Error

      The specified CGI application misbehaved by not returning a complete set of HTTP headers.

      What does this mean? What's going wrong?

      Thanks in advance.

      Gorby

        Your program couldn't open the file and died before it printed the header. I'm sure if you look in the error log you'll see the message.

        If you print the header before you try to open the file, you won't see the 500 error.

Re: print header; malfunctions in Windows 2003 Server
by ikegami (Patriarch) on Aug 19, 2005 at 16:41 UTC

    What error are you getting? Check the error logs.