>Number: 789
>Category: documentation
>Synopsis: Bad Perl Code is mentioned in the FAQ, #31
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: apache (Apache HTTP Project)
>State: open
>Class: doc-bug
>Submitter-Id: apache
>Arrival-Date: Thu Jun 26 00:30:01 1997
>Originator: [EMAIL PROTECTED]
>Organization:
apache
>Release: 1.2b8
>Environment:
All... it's in documentation
>Description:
The perl code example in #31 of the Apache FAQ is flawed in 3 ways.
a) the regex is wrong as it allows /foonph-cgi (due to the /*).
b) printf is not needed. print should be used.
c) no semi colon should be after the if statement.
see the way to fix it.
>How-To-Repeat:
31.How can I get my script's output without Apache buffering it
in the FAQ
>Fix:
the perl code is now:
if ($0 =~ m:/*nph-:) {
$HTTP_headers = "HTTP/1.1 200 OK\015\012";
$HTTP_headers .= "Connection: close\015\012";
printf ($HTTP_headers);
};
and it should
a) the regex is wrong as it allows /foonph-cgi (due to the /*).
b) printf is not needed. print should be used.
c) no semi colon should be after the if statement.
if ($0 =~ m:/nph-:) {
$HTTP_headers = "HTTP/1.1 200 OK\015\012";
$HTTP_headers .= "Connection: close\015\012";
print $HTTP_headers;
}
>Audit-Trail:
>Unformatted: