That doesn't mean squat when it comes to CGI.
For CGI, Perl scripts will be executed by the web server in a special environment. Also the web server will expect the beginning of the output to be a valid set of HTTP headers.
The special environment doesn't exist when run from the command line. You have not mentioned whether or not the output starts with a valid set of HTTP headers or not.
The Apache error indicates you are not generating a valid set of HTTP headers. Please ensure you are generating a valid set of HTTP headers.
Example code below:
my @http_headers = (
my $content = <<_TEXT_;
This is an example of a CGI script.
# response headers separated by linebreaks
join("\n", @http_headers) .
# double linebreak to separate headers from content
# response content
One can also use the CGI::Carp module. From CGI::Carp documentation:
If you want to send fatal (die, confess) errors to the browser, ask to import the special
use CGI::Carp qw(fatalsToBrowser);
die "Bad error here";
Fatal errors will now be echoed to the browser as well as to the log. CGI::Carp arranges to send a minimal HTTP header to the browser so that even errors that occur in the early compile phase will be seen. Nonfatal errors will still be directed to the log file only (unless redirected with carpout).
Perl / MySQL / HTML+CSS