You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by John Dunlap <jo...@lariat.co> on 2014/03/18 16:59:02 UTC

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

Re: Custom response problem

Posted by John Dunlap <jo...@lariat.co>.
@Andreas Mock: "2.000007"

@James Smith: That worked! Thanks!


On Tue, Mar 18, 2014 at 12:25 PM, Andreas Mock <an...@web.de> wrote:

> What does this give to you?
>
>
>
> perl -MApache2::RequestRec -e'print Apache2::RequestRec->VERSION'
>
>
>
>
>
> Regards
>
> Andreas
>
>
>
>
>
> *Von:* John Dunlap [mailto:john@lariat.co]
> *Gesendet:* Dienstag, 18. März 2014 17:16
> *An:* Andreas Mock
> *Cc:* mod_perl list
> *Betreff:* Re: Custom response problem
>
>
>
> 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 <an...@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
>
>
>
>
>

AW: Custom response problem

Posted by Andreas Mock <an...@web.de>.
What does this give to you?

 

perl -MApache2::RequestRec -e'print Apache2::RequestRec->VERSION'

 

 

Regards

Andreas

 

 

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

 

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 <an...@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

 

 


AW: Custom response problem

Posted by Andreas Mock <an...@web.de>.
Thia is what I meant with "loading".

So, I should have been more precise: "using"  :-)

 

Andreas

 

 

Von: James Smith [mailto:js5@sanger.ac.uk] 
Gesendet: Dienstag, 18. März 2014 17:25
An: modperl@perl.apache.org
Betreff: Re: Custom response problem

 


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 <an...@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. 


Re: Custom response problem

Posted by James Smith <js...@sanger.ac.uk>.
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 
> <ma...@web.de>> wrote:
>
>     Have you loaded Apache2::RequestRec?
>
>     Best regards
>
>     Andreas Mock
>
>     *Von:*John Dunlap [mailto:john@lariat.co <ma...@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. 

Re: Custom response problem

Posted by John Dunlap <jo...@lariat.co>.
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 <an...@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
>
>
>

AW: Custom response problem

Posted by Andreas Mock <an...@web.de>.
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

 


Re: Custom response problem

Posted by Adam Prime <ad...@utoronto.ca>.
I rarely use anything outside of Apache2::Const qw/:common/

:common
     Apache2::Const::AUTH_REQUIRED
     Apache2::Const::DECLINED
     Apache2::Const::DONE
     Apache2::Const::FORBIDDEN
     Apache2::Const::NOT_FOUND
     Apache2::Const::OK
     Apache2::Const::REDIRECT
     Apache2::Const::SERVER_ERROR

from http://perl.apache.org/docs/2.0/api/Apache2/Const.html

The main exception to that for me is using HTTP_MOVED_PERMANENTLY for 301's.

These constants are all imported from httpd, which is why they might 
differ from the actual HTTP status code from the HTTP spec.

Adam




On 14-03-18 12:42 PM, John Dunlap wrote:
> This is something that could definitely be better documented. I've
> already been thrown for a loop by them on several occasions. Sadly, you
> can't just return the numeric status codes(which are clearly documented
> in the HTTP specifications) because the values of the constants do not
> match their corresponding HTTP status codes. Things get even more
> confusing when you realize that there are also multiple constants for
> many of the HTTP status codes. I actually have a hash in my application
> that maps numeric HTTP status codes to the correct constants(I hard
> coded the constant in my example because I wanted to test the error with
> the simplest possible scenario). Because of this, I actually have a hash
> in my application that maps numeric HTTP status codes to the correct
> constants. That way I can just use the numeric codes(which ARE clearly
> document) while also returning the correct constants, assuming that I've
> correctly mapped the numeric codes to the correct constants.
>
> With that said, how can I be sure that I'm using the correct constants?
> My existing mappings are as follows:
> use constant STATUS_MAP => {
> '100' => HTTP_CONTINUE,
> '101' => HTTP_SWITCHING_PROTOCOLS,
> '200' => OK,
> '201' => HTTP_CREATED,
> '202' => HTTP_ACCEPTED,
> '203' => HTTP_NON_AUTHORITATIVE,
> '204' => HTTP_NO_CONTENT,
> '205' => HTTP_RESET_CONTENT,
> '206' => HTTP_PARTIAL_CONTENT,
> '300' => HTTP_MULTIPLE_CHOICES,
> '301' => HTTP_MOVED_PERMANENTLY,
> '302' => HTTP_MOVED_TEMPORARILY,
> '303' => HTTP_SEE_OTHER,
> '304' => HTTP_NOT_MODIFIED,
> '305' => HTTP_USE_PROXY,
> '307' => HTTP_TEMPORARY_REDIRECT,
> '400' => HTTP_BAD_REQUEST,
> '401' => HTTP_UNAUTHORIZED,
> '402' => HTTP_PAYMENT_REQUIRED,
> '403' => HTTP_FORBIDDEN,
> '404' => HTTP_NOT_FOUND,
> '405' => HTTP_METHOD_NOT_ALLOWED,
> '406' => HTTP_NOT_ACCEPTABLE,
> '407' => HTTP_PROXY_AUTHENTICATION_REQUIRED,
> '408' => 408,
> '409' => HTTP_CONFLICT,
> '410' => HTTP_GONE,
> '411' => HTTP_LENGTH_REQUIRED,
> '412' => HTTP_PRECONDITION_FAILED,
> '413' => HTTP_REQUEST_ENTITY_TOO_LARGE,
> '414' => HTTP_REQUEST_URI_TOO_LARGE,
> '415' => HTTP_UNSUPPORTED_MEDIA_TYPE,
> '416' => HTTP_RANGE_NOT_SATISFIABLE,
> '417' => HTTP_EXPECTATION_FAILED,
> '500' => HTTP_INTERNAL_SERVER_ERROR,
> '501' => HTTP_NOT_IMPLEMENTED,
> '502' => HTTP_BAD_GATEWAY,
> '503' => HTTP_SERVICE_UNAVAILABLE,
> '504' => HTTP_GATEWAY_TIME_OUT,
> '505' => 505
> };
>
>
>
>
>
> On Tue, Mar 18, 2014 at 12:33 PM, Adam Prime <adam.prime@utoronto.ca
> <ma...@utoronto.ca>> wrote:
>
>     I'm pretty sure you should be using Apache2::Const::SERVER_ERROR,
>     not the HTTP_* constants. This could probably be documented better.
>     You should likely be returning that constant instead of the HTTP_*
>     ones as well.
>
>     Adam
>
>
>     On 14-03-18 11:59 AM, John Dunlap wrote:
>
>         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
>
>
>


Re: Custom response problem

Posted by John Dunlap <jo...@lariat.co>.
This is something that could definitely be better documented. I've already
been thrown for a loop by them on several occasions. Sadly, you can't just
return the numeric status codes(which are clearly documented in the HTTP
specifications) because the values of the constants do not match their
corresponding HTTP status codes. Things get even more confusing when you
realize that there are also multiple constants for many of the HTTP status
codes. I actually have a hash in my application that maps numeric HTTP
status codes to the correct constants(I hard coded the constant in my
example because I wanted to test the error with the simplest possible
scenario). Because of this, I actually have a hash in my application that
maps numeric HTTP status codes to the correct constants. That way I can
just use the numeric codes(which ARE clearly document) while also returning
the correct constants, assuming that I've correctly mapped the numeric
codes to the correct constants.

With that said, how can I be sure that I'm using the correct constants? My
existing mappings are as follows:
use constant STATUS_MAP => {
'100' => HTTP_CONTINUE,
'101' => HTTP_SWITCHING_PROTOCOLS,
'200' => OK,
'201' => HTTP_CREATED,
'202' => HTTP_ACCEPTED,
'203' => HTTP_NON_AUTHORITATIVE,
'204' => HTTP_NO_CONTENT,
'205' => HTTP_RESET_CONTENT,
'206' => HTTP_PARTIAL_CONTENT,
'300' => HTTP_MULTIPLE_CHOICES,
'301' => HTTP_MOVED_PERMANENTLY,
'302' => HTTP_MOVED_TEMPORARILY,
'303' => HTTP_SEE_OTHER,
'304' => HTTP_NOT_MODIFIED,
'305' => HTTP_USE_PROXY,
'307' => HTTP_TEMPORARY_REDIRECT,
'400' => HTTP_BAD_REQUEST,
'401' => HTTP_UNAUTHORIZED,
'402' => HTTP_PAYMENT_REQUIRED,
'403' => HTTP_FORBIDDEN,
'404' => HTTP_NOT_FOUND,
'405' => HTTP_METHOD_NOT_ALLOWED,
'406' => HTTP_NOT_ACCEPTABLE,
'407' => HTTP_PROXY_AUTHENTICATION_REQUIRED,
'408' => 408,
'409' => HTTP_CONFLICT,
'410' => HTTP_GONE,
'411' => HTTP_LENGTH_REQUIRED,
'412' => HTTP_PRECONDITION_FAILED,
'413' => HTTP_REQUEST_ENTITY_TOO_LARGE,
'414' => HTTP_REQUEST_URI_TOO_LARGE,
'415' => HTTP_UNSUPPORTED_MEDIA_TYPE,
'416' => HTTP_RANGE_NOT_SATISFIABLE,
'417' => HTTP_EXPECTATION_FAILED,
'500' => HTTP_INTERNAL_SERVER_ERROR,
'501' => HTTP_NOT_IMPLEMENTED,
'502' => HTTP_BAD_GATEWAY,
'503' => HTTP_SERVICE_UNAVAILABLE,
'504' => HTTP_GATEWAY_TIME_OUT,
'505' => 505
};





On Tue, Mar 18, 2014 at 12:33 PM, Adam Prime <ad...@utoronto.ca> wrote:

> I'm pretty sure you should be using Apache2::Const::SERVER_ERROR, not the
> HTTP_* constants. This could probably be documented better. You should
> likely be returning that constant instead of the HTTP_* ones as well.
>
> Adam
>
>
> On 14-03-18 11:59 AM, John Dunlap wrote:
>
>> 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
>>
>>
>

Re: Custom response problem

Posted by Adam Prime <ad...@utoronto.ca>.
I'm pretty sure you should be using Apache2::Const::SERVER_ERROR, not 
the HTTP_* constants. This could probably be documented better. You 
should likely be returning that constant instead of the HTTP_* ones as well.

Adam

On 14-03-18 11:59 AM, John Dunlap wrote:
> 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
>