perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject Modperl handler status code. Handler invoked two times per request.
Date Sun, 01 Jul 2012 23:50:39 GMT

 I've found unexpected behavior of modperl handler. If handler return
 Apache2::Const::HTTP_OK status all is ok. But other HTTP_*
 status code (tested with Apache2::Const::HTTP_NOT_FOUND;
 Apache2::Const::HTTP_FORBIDDEN and Apache2::Const::SERVER_ERROR)
 invoke handler again.


<VirtualHost *:80>
    DocumentRoot "/srv/http/err/htdocs"
    ServerName err.localhost
    SetHandler 		perl-script

    PerlRequire /srv/http/err/htdocs/
    PerlResponseHandler	XYZ::Main

   package XYZ::Main;

   use strict;
   use APR::Table;
   use Apache2::RequestRec ();
   use Apache2::RequestIO ();
   use Apache2::Const -compile => qw/:common :http/;
   use CGI;

   sub handler{
     `echo "call" >>/tmp/inv`;
     return Apache2::Const::OK;
     return Apache2::Const::HTTP_OK;
     return Apache2::Const::HTTP_NOT_FOUND;


 Mainly, in some cases I want to show Apache2
 default pages (like for HTTP_NOF_FOUND and HTTP_SERVER_ERROR) and
 don't know right way to implement that. It seems that similar
 Apache2::Const::HTTP* status code from handler is a good way but now I
 have to use method-handler technique
 to avoid second handler invocations.

 So, whats wrong?


Apache/2.2.22 (Unix) DAV/2 PHP/5.4.4 mod_perl/2.0.7 Perl/v5.16.0 Server
at err.localhost Port 80Server version: Apache/2.2.22 (Unix)

View raw message