Apache 为什么$r->;在梅森处理程序打印标准页中打印?
当我在HTML::Mason::ApacheHandler中执行此操作时Apache 为什么$r->;在梅森处理程序打印标准页中打印?,apache,mod-perl2,mason,Apache,Mod Perl2,Mason,当我在HTML::Mason::ApacheHandler中执行此操作时 sub handler { my ($r) = @_; $r->content_type('text/plain'); $r->print( 'YES' ); $r->log_error( $r->bytes_sent ); return 200; } 我得到页面: OK The server encountered an internal erro
sub handler {
my ($r) = @_;
$r->content_type('text/plain');
$r->print( 'YES' );
$r->log_error( $r->bytes_sent );
return 200;
}
我得到页面:
OK
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.22 (Debian) Server at localhost Port 443
如何将“是”打印到浏览器?我必须添加
使用Apache2::RequestIO代码>到my handler.pl
当出现问题时,我必须更加注意检查/var/log/apache2/error.log
要使用自定义页面进行响应,我可以使用自定义响应
sub handler {
my ($r)=@_;
@{$r->pnotes}{qw/etext ect/}=("sorry, no access\n", 'text/plain; charset=my-characters');
$r->custom_response( 403, "/-/error" );
return 403;
}
完整示例您应该返回Apache2::Const::OK或其他适当的Apache2返回值,而不是HTTP状态。返回500是因为我忘记了使用Apache2::RequestIO