I should add that this segv only happens when using push_handlers like below. If I put Control::Super::Sub->handler inside a <Location> tag in httpd.conf then it is fine.
Ric ----- Original Message ----- From: "Richard Clarke" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 3:55 PM Subject: OO handlers > List, > Tired of having 10 modules all with near identical handler methods I > decided to put the handler method into a superclass and be done with > maintaining the same code 10 times. I first tried this a couple of weeks ago > and it failed to work, because at the time I couldn't find the reference to > OO style handler methods in my Eagle book. Since the mod_perl cookbook is > now available on safari I had a quick flick through and noticed a brief > mention on OO style handler methods along with the snippet of info I needed > i.e. sub handler ($$). > > To cut a long story short my subclasses are now empty (for the moment) and > they inherit (or a least should be doing) from the main superclass. > Something like, > use Control/Super.pm > @Control::Super::Sub::ISA = Control::Super; > > I use a "dispatch" module with a basic handler to choose which module will > process a particular uri. > It now adds the module to be called like follows, > my $sub = join '::', 'Control', ucfirst $module, ucfirst $sub_stage; > $r->push_handlers('PerlHandler',$sub->handler); > > The meaning of $module and $sub_stage is unimportant here. > > And the Superclass handler looks like > sub handler ($$) { > my $self = shift; > my $r = Apache::Request->instance(shift); > # do stuff > } > > Testing this with httpd -X causes a segfault every time I go to the URL. So > my question is, before I try to figure out why it segv's, is this kind of > thing allowed?, or is there some caveat which prevents handlers being > invoked if they come from a supeclass? > > All help appreciated as usual, > Richard. > > > >