Jul 6, 2001, 11:10 AM
Post #3 of 4
Re: Premature End of Script Headers Error
[In reply to]
Pro_4 is right, you should use the CGI package. Also, you should include CGI::Carp. A nice header for a CGI script to start is normally
The -no_debug is optional. It just stops CGI from always asking you for input when you're testing on the commandline.
use CGI qw(-no_debug :standard);
use CGI::Carp qw(fatalsToBrowser);
The CGI::Carp will echo Perl errors to the browser, making script debugging a lot easier.
The use strict; will force clean Perl code.
With the CGI package, you can use
to print a standard redirection header. I've also noticed that you try comparing IP addresses with ==, but as you actually compare strings, you have to use eq. Using -w would have warned you.
Pro_4, there's no need for semicolons at the end of a block. But if your block isn't a one-liner, I'd recommand putting a semicolon there, too.
Hope this helps,
(This post was edited by mhx on Jul 6, 2001, 10:38 AM)