Tom Servo wrote:
> This is probably a pointless question, but I'm mostly just curious if
> there is any way to get this to work.
>
> I've got two modules, Parent.pm and Child.pm. Parent.pm has a sub
> handler in it, and Child.pm has Parent in @ISA. I can run a little
> driver script over these two and call Child::handler and have it execute
> Parent::handler, so I know the inheritance is working.
>
> However, if I setup my location directive like this:
>
> <Location /test_child>
> SetHandler perl-script
> PerlHandler Child
> </Location>
>
> It tells me "Undefined subroutine &Child::handler called".
>
> I'm using Parent & Child in startup.pl, and also doing a use Parent; in
> Child.pm for good measure.
>
> Is there any way to get mod_perl to execute the handler in the parent
> class automatically? Am I just completely missing something?
so long as you're preloading Child.pm via startup.pl or PerlModule,
you probably just need to prototype your handler:
sub handler ($$) {
my ($class, $r) = @_;
}
or, with later perls
sub handler : method {
my ($class, $r) = @_;
}
you're using a feature called "method handlers" so you can look that
up in the mod_perl literature for more information.
--Geoff