invalid title from script. Bad title = & lt; body & gt ;: I encountered the above error. The main script is belo...">

Perl CGI: error message: <br/"> invalid title from script. Bad title = & lt; body & gt ;:

I encountered the above error.

The main script is below

#!/opt/lampp/bin/perl use lib "/opt/lampp/htdocs/PERL"; use warnings; use strict; use CGI; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use WEBPAGE::PageDesign; use HTML::Form; my $header = get_header() ; my $html = parse_form(\%ENV); print "Content-type: text/html\n\n"; print <<HTML; $header $html HTML 

The html created is correct, but a script with an html page followed by an error

 Error message: <br />malformed header from script. Bad header=&lt;body&gt;: publish_scholarship.pl, 
+4
source share
1 answer

Move the print title bar up. If it still does not work, move it to the BEGIN block.

 use warnings; use strict; BEGIN { print "Content-type: text/html\n\n"; } use lib "/opt/lampp/htdocs/PERL"; use CGI; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use WEBPAGE::PageDesign; use HTML::Form; my $header = get_header() ; my $html = parse_form(\%ENV); print <<HTML; $header $html HTML 
+2
source

All Articles