hello, 
 
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: 

Apache/2.0.53 (Win32) mod_perl/2.0.2 Perl/v5.8.8 

<VirtualHost>
        ServerName xxx
        <Perl>
        use lib "somepathtolib";
        require "/path/to/startup.pl";
        </Perl>
        <Location />
                SetHandler modperl
                PerlFixupHandler $MyWebApp::Handler->fixup
        </Location>
</VirtualHost>


startup.pl
-----------------------------------
use strict;
use lib "somepathtolib";
use WebApp::Handler;

$MyWebApp::Handler = new WebApp::Handler();


WebApp/Handler.pm
------------------------------------

package WebApp::Handler;
use strict;

sub fixup : method {
        my ($self, $r) = @_;
        my $test = ... # do some tests on uri
        if ($test ne '1') {
                # if test fails then set PerlResponseHandler to method
'response' of $self.
                $r->handler('modperl');
                
                # version 1:
                $r->set_handlers(PerlResponseHandler =>
$self->response);       
                        #       response is called, but only with one
parameter 'WebApp::Handler=HASH(0xf00ff4)

                # version 2:
                $r->set_handlers(PerlResponseHandler =>
$self->can('response'));
                        # response is called, but only with one
parameter 'Apache2::RequestRec=SCALAR(0xab508c)'

        }
        return Apache2::Const::OK;
}

sub response : method {
        my ($self, $r) = @_;
        # generate my response
}

Reply via email to