Hi all,

Well, here is my 'header' and 'ender' file module that I put in a
require('html.pm') statement near the beginning of my perl scripts.

When I am ready to output info back to the browser, I do something like:

&HTML_header($some_header_text);
print "<body>\n";
print "$msg\n"; # prints required message to the screen
... other print statements
&HTML_ender;

The frustrating thing is, it works fine for other perl programs.  In fact
the program that generates the error is very similar to another one that
works as expected :(

The 'html.pm' script I use (i.e. require('html.pm')) in my perl scripts is:

# html.pm

sub HTML_header {
# Put up standard HTTP opening line.
print "Content-type: text/html\n\n";
# Specify HTML document.
print "<html>\n\n";
# Specify header section.
print "<head>\n\n";
print "<link type=\"text/css\" rel=\"stylesheet\"
href=\"main_style.css\">\n\n";
# Put up the title line, specified as the parameter from the calling module.
print "<title>", "@_", "</title>\n\n";
# End header section.
print "</head>\n\n";
} # End HTML_header

# Set up a standard HTML footer section.  At this point,
# it simply ends the BODY and HTML sections.
sub HTML_ender {
    print "\n\n\n";
# Print the copyright information
    print "<center>\n";
    print "<font size=\"-2\">\n";
    print "&nbsp;&nbsp;Copyright&nbsp;&copy;&nbsp;2003. All rights
reserved.\n";
    print "</font>\n";
    print "</center>\n";
# End the html section
    print "</body>\n\n";
    print "</html>\n\n";
} # End HTML_ender
return 1;



-----Original Message-----
From: Camilo Gonzalez [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 06 August, 2003 1:20 AM
To: Mike Harrison
Cc: [EMAIL PROTECTED]
Subject: Re: Perl line breaks


Mike Harrison wrote:

>Hello all,
> 
>Well, I have spent the last few nights messing around trying to work out
why
>one of my PERL programs doesn't work.  If anybody can shed some light on
>this, I might be able to get some sleep :)
> 
>I am using a hosting service to host my web site, and they use a Microsoft
>NT-based server system (sorry, I don't know the nitty-gritty details).
They
>allow user cgi programs (PERL, PHP etc.), and until now most of my PERL
>programs have worked as expected.  I am using NTEmacs as a text editor for
>my HTML & PERL programming.
> 
>With one program, I am getting an error message as follows:
> 
>CGI Error
>The specified CGI application misbehaved by not returning a complete set
>of HTTP headers. The headers it did return are:
>
> 
>(nothing else is printed to the screen after 'The headers it did return
>are:')
> 
>My question is:  Are line breaks important with PERL programs, and if so,
>any tips?  If line breaks are not likely to be the problem in this case,
>does anybody know why I am getting this error?
> 
>Note that I have a similar PERL program in the same directory that works
>fine.  So I think it is my program and not the web server...  It might be I
>have overlooked an important detail that I can't see on the screen - such
as
>line breaks or other non-printable characters???
> 
>Thanks in advance for any help,
>Mike.
> 
>
>  
>
How are you generating your HTTP headers? Can you post some code?

Reply via email to