Re: Write PerlPostReadRequestHandler

André Warnier <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Raf wrote:
> http://perl.apache.org/docs/2.0/user/intro/start_fast.html
> 
> On Thu, 19 May 2011, marco wrote:
> 
>> Hi,
>> I tried to write an handler to be execute in the PostReadRequest phase 
>> of the http request cycle.
>> #file:touch.pl
> ...
>>      PerlResponseHandler touch.pl
> ...
>> PerlPostReadRequestHandler touch.pl
>                              ^^^^^^^^
> This should be the package name of a module on your @INC path.
> 
>> But I'm a little confused on what I wrote. I followed the ufficial 
>> guide but it was not very clear.
> You might want to look at 
> http://perl.apache.org/docs/2.0/user/intro/start_fast.html again.
> 

More precisely, the section : "Handler Modules"

The steps there are exactly what you need to do.

Look carefully at the example perl code.
- rename your script to "touch.pm"  (a convention, for mod_perl handler modules)
- change your script a bit, to resemble the example, with the

sub handler {
...
}
1;

That "1;" at the end is very important.
Also important is that your handler subroutine should return "OK" to Apache.

Also change
PerlPostReadRequestHandler touch.pl
to
PerlPostReadRequestHandler touch
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.