This is a discussion on using object-methods in set_handlers - modperl ; hello,=20 =20 i've got the following issue, i'm using an Object-method as PerlFixupHandler, and depending on some Tests on the uri i want to set the modperl Handler to another method of the object (not the class).(see also the comments ...
hello,=20
=20
i've got the following issue, i'm using an Object-method as
PerlFixupHandler, and depending on some Tests on the uri i want to set
the modperl Handler to another method of the object (not the class).(see
also the comments in the code below)
Any Suggestions out there?
thanks in advance
gernot
My Configuration:=20
Apache/2.0.53 (Win32) mod_perl/2.0.2 Perl/v5.8.8=20
ServerName xxx
use lib "somepathtolib";
require "/path/to/startup.pl";
SetHandler modperl
PerlFixupHandler $MyWebApp::Handler->fixup
startup.pl
-----------------------------------
use strict;
use lib "somepathtolib";
use WebApp::Handler;
$MyWebApp::Handler =3D new WebApp::Handler();
WebApp/Handler.pm
------------------------------------
package WebApp::Handler;
use strict;
sub fixup : method {
my ($self, $r) =3D @_;
my $test =3D ... # do some tests on uri
if ($test ne '1') {
# if test fails then set PerlResponseHandler to method
'response' of $self.
$r->handler('modperl');
=09
# version 1:
$r->set_handlers(PerlResponseHandler =3D>
$self->response);=09
# response is called, but only with one
parameter 'WebApp::Handler=3DHASH(0xf00ff4)
# version 2:
$r->set_handlers(PerlResponseHandler =3D>
$self->can('response'));
# response is called, but only with one
parameter 'Apache2::RequestRec=3DSCALAR(0xab508c)'
}
return Apache2::Const::OK;
}
sub response : method {
my ($self, $r) =3D @_;
# generate my response
}