Le lundi 02 juillet 2012 à 03:50 +0400, [email protected] a écrit :
> Hello.
Hi,
> So, whats wrong?
>
Dude, a lot of things...
Not sure I can catch them all, but since nobody is tackling it, see some
comments below.
> I've found unexpected behavior of modperl handler. If handler return
> Apache2::Const::HTTP_OK status all is ok.
? I get an error code with this, after the 200 OK, so I'm surprised it
works for you
> But other HTTP_*
> status code (tested with Apache2::Const::HTTP_NOT_FOUND;
> Apache2::Const::HTTP_FORBIDDEN and Apache2::Const::SERVER_ERROR)
> invoke handler again.
>
I don't see this
> Configuration:
>
> <VirtualHost *:80>
> DocumentRoot "/srv/http/err/htdocs"
> ServerName err.localhost
> SetHandler perl-script
>
I think the following should be PerlModule instead of PerlRequire?
> PerlRequire /srv/http/err/htdocs/Main.pm
I would wrap the following into a Location directive
> PerlResponseHandler XYZ::Main
> </VirtualHost>
>
> Module:
> package XYZ::Main;
>
> use strict;
the following line is unneeded
> use APR::Table;
the following line is unneeded
> use Apache2::RequestRec ();
the following line is unneeded
> use Apache2::RequestIO ();
this one is needed
> use Apache2::Const -compile => qw/:common :http/;
the following line is unneeded
> use CGI;
>
> sub handler{
> `echo "call" >>/tmp/inv`;
this works
> return Apache2::Const::OK;
the following lines won't happen after the first return
> return Apache2::Const::HTTP_OK;
> return Apache2::Const::HTTP_NOT_FOUND;
> }
>
> 1;
>
> 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
> (https://perl.apache.org/docs/2.0/user/coding/coding.html#Method_Handlers)
> to avoid second handler invocations.
It seems to me like you are copy/pasting code and hoping it will work.
I suggest you invest some time in the documentation first, like reading
this throughout :
https://perl.apache.org/docs/2.0/user/index.html
It's worth it.
--
Vincent Veyron
http://vincentveyron.com/
Logiciels de gestion des sinistres assurances et des dossiers contentieux pour
le service juridique