Try:

     use Apache2::Response ();

This should add the method to $r (a lot of the Apache2:: modules do this - Apache2::RequestUtil, Apache2::Upload etc)
On 18/03/2014 16:16, John Dunlap wrote:
I've tried it with "use Apache2::RequestRec;" at the top of my handler and without it. The outcome is the same in both cases. If I attempt to install it from CPAN, it says that it is already installed.


On Tue, Mar 18, 2014 at 12:13 PM, Andreas Mock <andreas.mock@web.de> wrote:

Have you loaded Apache2::RequestRec?

 

Best regards

Andreas Mock

 

 

Von: John Dunlap [mailto:john@lariat.co]
Gesendet: Dienstag, 18. März 2014 16:59
An: mod_perl list
Betreff: Custom response problem

 

I recently upgraded my workstation from Debian 6 to Debian 7 and I'm now encountering a problem that I haven't seen before. My apache version is 2.2.22-13+deb7u1. My mod_perl version is 2.0.7-3. I'm guessing that I have an installation problem of some kind but I'm not sure where to look for problems. My application works correctly until I attempt to define a custom response, as follows,

 

sub handler {

            my $apache = shift; 

            $apache->custom_response(Apache2::Const::HTTP_INTERNAL_SERVER_ERROR, 'hi mom');

            return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;

}

 

I see a 500 error, which is what I want, when I access the page. However the error page is the default apache 500 error response page and I want to override it. When I look in the logs, I see this:

 

[Tue Mar 18 15:41:32 2014] [error] [client 127.0.0.1] Can't locate object method "custom_response" via package "Apache2::RequestRec" at /usr/local/lariat-trunk/qa-trunk/lib/Lariat/V4/WS/RS/BootstrapHandler.pm line 41.

 

This would imply, at least to me, that this method is not compiled into mod_perl or perhaps into apache itself but I cannot be sure. Any suggestions?

 

Cheers!

John

 




-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.